2012-02-10 3 views
1

上記の5年間asp.netを使用しています。しかし今、奇妙な問題に直面しています。私がasp:button、asp:textboxなどを含む私の作成したフォームから、いつもIsPostBackにfalseを伝えるコードページに電子メールを送信しようとすると、メールを送信ボタン(asp.netボタン)をクリックしても。何が問題なのか理解できない。ボタンやその他をクリックするとIsPostbackが常にfalseになる

ポストバックのためにweb.configファイルに必要なものは何ですか?

テストページhttp://buyerrs.com/Test.aspx

テストページでの問題ではないと確信しています。 vbには&のコードが1つしかない非常に正常なページです。 cache、urlrewrite、web.configのどこかに問題があります。しかし、私はどこを理解できないのですか?

<?xml version="1.0" encoding="UTF-8"?> 
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 

    <configSections> 
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
     <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
     <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> 
     <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
      <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> 
      <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
      <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
      <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
     </sectionGroup> 
     </sectionGroup> 
    </sectionGroup> 
    </configSections> 

    <system.web> 

    <httpHandlers> 
     <remove verb="*" path="*.asmx"/> 
     <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> 
     <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/> 
    </httpHandlers> 

     <httpModules> 
     <add name="vchHttpModule" type="VchBaseSite.vchHttpModule" /> 
     </httpModules> 

     <!-- need to increase the size of the permitted upload size --> 
     <httpRuntime maxRequestLength="20480" /> 

     <!-- set compilation debug="false" for running application --> 
     <compilation debug="true" strict="false" explicit="true" defaultLanguage="vb"> 
     <assemblies> 
      <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
      <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
      <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
     </assemblies> 
     </compilation> 

     <trace enabled="false" pageOutput="true" localOnly="true" /> 

     <sessionState mode="Off" /> 

     <!-- customErrors mode="On|Off|RemoteOnly" --> 
     <customErrors mode="Off"> 
     <error statusCode="404" redirect="404.aspx" /> 
     <error statusCode="500" redirect="500.html" /> 
     </customErrors> 

     <pages enableViewState="false"> 
     <namespaces> 
      <clear /> 
      <add namespace="System" /> 
      <add namespace="System.Collections" /> 
      <add namespace="System.Collections.Generic" /> 
      <add namespace="System.Configuration" /> 
      <add namespace="System.IO" /> 
      <add namespace="System.IO.Compression" /> 
      <add namespace="System.Linq" /> 
      <add namespace="System.Text" /> 
      <add namespace="System.Web" /> 
      <add namespace="System.Web.Security" /> 
      <add namespace="System.Web.UI.WebControls" /> 
      <add namespace="System.Web.UI" /> 
      <add namespace="System.Xml.Linq" /> 
     </namespaces> 
     <controls> 
      <add tagPrefix="vch" namespace="VchBaseSite" assembly="VchBaseSite" /> 
     </controls> 
     </pages> 

     <!-- set code access security trust level - this is generally set in the machine.config 
     <trust level="Medium" originUrl=".*" />--> 

     <machineKey 
     validationKey="CF19275EF5E6206C1E289BAC5240240548B1015A2A68137B411A08E2F2BFE55223C42B1FECB10B6A660CD00DEE02F005959D7E4929660A81CF756E69BF3F56C8" 
     decryptionKey="A32BD7AEDF208B05B85828E644774810C928F5F76A6AD0A50F982EBD235634A3" 
     validation="SHA1" decryption="AES" 
     /> 

     <authentication mode="None" /> 

     <roleManager> 
      <providers> 
       <clear /> 
      </providers> 
     </roleManager> 

    </system.web> 

    <system.codedom> 
     <compilers> 
     <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
      <providerOption name="CompilerVersion" value="v3.5" /> 
      <providerOption name="WarnAsError" value="false" /> 
     </compiler> 
     <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
      <providerOption name="CompilerVersion" value="v3.5" /> 
      <providerOption name="OptionInfer" value="true" /> 
      <providerOption name="WarnAsError" value="false" /> 
     </compiler> 
     </compilers> 
    </system.codedom> 

    <!-- 
    The system.webServer section is required for running ASP.NET AJAX under Internet 
    Information Services 7.0. It is not necessary for previous version of IIS. 
    --> 
    <system.webServer> 
     <validation validateIntegratedModeConfiguration="false" /> 


<!-- 
     <defaultDocument> 
     <files> 
      <clear /> 
      <add value="default.aspx" /> 

      <add value="Default.aspx" /> 
      <add value="default.htm" /> 
      <add value="Default.htm" /> 
     </files> 
     </defaultDocument> --> 
    </system.webServer> 

    <runtime> 
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727"> 
     <dependentAssembly> 
      <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" /> 
      <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
      <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" /> 
      <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /> 
     </dependentAssembly> 
     </assemblyBinding> 

     <connectionStrings> 
     <remove name="LocalSqlServer" /> 
     </connectionStrings> 
    </runtime> 

</configuration> 

これはエラーがを上昇ところ最後に私が見つけた

web.configファイルです。このhttp://www.datafeedscripts.net/default.aspxソフトウェアに基づくこのウェブサイトのコード。彼らは3つのdllファイル(vchsite.dll、vchLicense.dll、vchbasesite.dll)を使用して、私は除外した場合

<httpModules> 
    <add name="vchHttpModule" type="VchBaseSite.vchHttpModule" /> 

以下HttpModuleをコードを持っているDLLと、web.configファイルのポストバックからHttpModuleを行を削除していますうまく動作します。これは誤りです。彼らは、Dllファイルやhttpモジュールで何か間違ったことをしました。

しかし、まだ何がエラーであるか理解できません。 dllファイルからポストバックアクションを制御する機会がありますか?

+1

あなたのコードを教えていただけますか? aspxとaspx.cs? –

+0

新しいテストフォームを作成してもう一度試してください。コピーして貼り付けないでください。手動でコントロールを作成します。 – IrishChieftain

+0

hi @IrishChieftain。私は新しいテストページhttp://buyerrs.com/Test.aspxを作成してみました。動いていない。同じ問題。 –

答えて

0

、自分のホームページのソースを見てみる:

IsPostBack : False on 2/10/2012 3:50:06 PM 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
... 

どのように一体ということです「IsPostBackプロパティ:偽..」宣伝文句があなたのDOCTYPEの前に置かれています。保護されたSub Page_Loadイベントハンドラをチェックし、正しい構文などであることを確認します。これは、IsPostBackの正しい状態を取得する前に発生する可能性があるためです。

+2

)Response.Writeはコードビハインドから完了したときにページの最初のものとして内容を書き出します。 –

+1

これはResponse.Writeと同じです –

+0

ページの前にページの読み込みが発生しますレンダリングされるので、最初に終了します。 – zeal

0

わからないと思います。 AutoEventWireupをfalseにすると、PageLoadは呼び出されませんが、それは...有線と呼ばれます。他のクラスがロードされている可能性があります。

AutoEventWireup="false" 

結果を確認するには、これをtrueにすることはできますか?

0

PageタグでAutoEventWireupをtrueに設定してみてください。

+0

テストページで問題ないことを確かめてください。ボタンとコードが1つしかない非常に正常なページです。キャッシュ内のどこかに問題があります。urlrewriteまたはweb.configですが、どこで理解できないのですか? –

+0

新しく設定されたテストプロジェクトを作成します。動作している場合は、設定ファイルを並べて比較します – IrishChieftain

0

私はあなたがif文それらに使用される各値を「読む」ことができます反射によってそれがhere also

を見つけることができますIsPostBackプロパティMSの実装で、見ていました。
残念ながら、私は、C#を使用して、私はあなたがあまりにもコントロールの値を取得することはできませんので、私は疑うあなたが

protected void Page_Load(object sender, EventArgs e) 
     { 
      Response.Write(IsPostBack.ToString() + " " + DateTime.Now.ToShortDateString()); 
      Response.Write("<br />"); 

      //return this._requestValueCollection != null && (this._isCrossPagePostBack 
      //|| (!this._pageFlags[8] && (this.Context.ServerExecuteDepth <= 0 
      //  || (this.Context.Handler != null && !(base.GetType() != this.Context.Handler.GetType()))) && !this._fPageLayoutChanged)); 

      var pType = this.GetType(); 
      while (pType.Name != "Page") 
       pType = pType.BaseType; 
      var _requestValueCollection = pType.GetField("_requestValueCollection", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this); 
      Response.Write("_requestValueCollection: " + (_requestValueCollection != null).ToString()); 
      Response.Write("<br />"); 

      var _isCrossPagePostBack = pType.GetField("_isCrossPagePostBack", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this); 
      Response.Write("_isCrossPagePostBack: " + _isCrossPagePostBack); 
      Response.Write("<br />"); 

      var _pageFlags = pType.GetField("_pageFlags", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this); 
      Response.Write("_pageFlags: " + (((int)_pageFlags.GetType().GetField("data", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(_pageFlags) & 8) == 8)); 
      Response.Write("<br />"); 
      //SimpleBitVetctor32 
      var cType = this.Context.GetType(); 
      var ServerExecuteDepth = cType.GetProperty("ServerExecuteDepth", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this.Context, null); 
      Response.Write("ServerExecuteDepth: " + ServerExecuteDepth.ToString()); 
      Response.Write("<br />"); 

      Response.Write("Context_Handler: " + (this.Context.Handler != null)); 
      Response.Write("<br />"); 


      var _fPageLayoutChanged = pType.GetField("_fPageLayoutChanged", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this); 
      Response.Write("_fPageLayoutChanged: " + _fPageLayoutChanged.ToString()); 
      Response.Write("<br />"); 

      Response.Write("base.GetType() != this.Context.Handler.GetType())) " + (base.GetType() != this.Context.Handler.GetType())); 
     } 

C# to VB

更新

をVBにそれを翻訳することを願って_requestValueCollectionがnullです。 _requestValueCollectionは、転記された値とクエリ文字列値のコレクションです。それでも問題は解決しません。

1

これはちょっと古いですが、私はHttpModuleをチェックします。 vchHttpModuleはリクエストをハイジャックしてIsPostBackを無効にすることができます。

関連する問題