IsPostback always false when i click button or any other

Vinoth Kannan picture Vinoth Kannan · Feb 10, 2012 · Viewed 13.7k times · Source

Am using asp.net for above 5 years. But now am facing a weird problem. When i try to send emails from form created by me which contains asp:button, asp:textbox, etc., in code page it always telling IsPostBack false. Even when i click the Send mail button(asp.net button). I cant understand what is problem.

Is it anything needed in web.config file for postback??

Test page http://buyerrs.com/Test.aspx

Am sure its not problem in Test page. Because it is very normal page which have only one button & code in vb. Problem somewhere in cache, urlrewrite or web.config. But i cant understand where?

    <?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>

this is web.config file

Finally I found where the error rising. This website code based on this http://www.datafeedscripts.net/default.aspx software. They are using three dll files (vchsite.dll, vchLicense.dll, vchbasesite.dll) and have a httpmodule code below

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

When i exclude that dlls and remove the httpmodule line from web.config file postback working fine. So this is error. They done something wrong in their Dll files or httpmodule.

But still can't understand what is error. Is it have chance to control postback action from dll files?

Answer

Steve picture Steve · Feb 1, 2014

I know this is a bit old but I would check the HttpModule. The vchHttpModule could be hijacking the request and invaliding the IsPostBack.