• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 545
  • Last Modified:

.Net Frameword 2.0 SP2 breaks image button event handlers

I have written an ASP.Net Web Site using VB.Net and if i dare install the .Net Framework 2.0 SP2 my image button events no longer fire and the user is re-directed to Home.aspx when clicking the image button. It works just fine as long as SP2 is not installed. See below for code example...

HTML:
<asp:ImageButton ID="bottomContinueButton" runat="server" imageurl="Images/Foundation/update 1.jpg" />

VB.Net Event Code:

    Protected Sub bottomContinueButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles bottomContinueButton.Click

        Dim datRequiredDate As Date
        Dim pblnViewPictures As Boolean = True
        Dim pstrCustomer, pstrStore As String

        Try
            datRequiredDate = RequiredDateBasicDatePicker.SelectedDate
        Catch ex As Exception
            datRequiredDate = Today.Date
        End Try

        If datRequiredDate = #12:00:00 AM# Then
            datRequiredDate = Today.Date
        End If

        pblnViewPictures = True

        If Page.IsValid Then

            Session("RequiredDate") = datRequiredDate
            Session("ViewPictures") = pblnViewPictures
            Session("PO") = poTextBox.Text.Trim
            Session("OrderDate") = Now
            Session("CustEmail") = EmailTextBox.Text.Trim

            pstrCustomer = Session("UserName").ToString.Trim
            pstrStore = ""
            If ShiptoDropDownList.Items.Count > 0 Then
                pstrStore = ShiptoDropDownList.SelectedValue.ToString
            End If

            'Set Session Variables for selected Store
            Session("Store") = pstrStore
            Session("MinOrdVal") = Min_Ord_Value(pstrCustomer, pstrStore)
            Set_Session_Tax_Info()

            If Session("CheckingOut") Is Nothing And mblnCheckingOut = False Then
                Response.Redirect("Categories.aspx")
            Else
                Response.Redirect("CheckOut.aspx")
            End If
        End If
End Sub

Open in new window

0
michouis
Asked:
michouis
  • 8
  • 4
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
Ok, I'm a little suprised that it worked before SP2 given that you don't appear to have an event handler declared in the markup (unless you're hooking up the event manually in code).

I suspect you just need to change your markup to:
<asp:ImageButton ID="bottomContinueButton" runat="server" imageurl="Images/Foundation/update 1.jpg" OnClick="bottomContinueButton_Click" />

Open in new window

0
 
Bob LearnedCommented:
There is an event handler attached in this line:

Protected Sub bottomContinueButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) _
     Handles bottomContinueButton.Click

Is this application running on a local IIS, remote IIS, or the internal web development server (Cassini)?
0
 
michouisAuthor Commented:
Thanks for noticing TheLearnedOne.

Problem happens on both a local IIS and Cassini. The actual web server is a Windows 2003 server on site running local IIS6.

I place a breakpoint in the click event handler and it never reaches the break point. Un-install .Net Framework 2.0 SP2 and all is well again. Very, very strange.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Bob LearnedCommented:
I have 2.0 SP2 installed, and my buttons still work on IIS and Cassini.  You might want to install 2.0 SP2, and create a new web site, and see if you still have the problem.
0
 
michouisAuthor Commented:
I just re-formatted my laptop and am installing ALL windows updates including .Net Framework 2.0 SP2. I will then copy over my Web Site and see if ay difference. If not then i will create a new Web Site and try it. Will update you when done.

P.S. I should not have to re-write my entire Web Site so it works with SP2 (hopefully!!!)
0
 
michouisAuthor Commented:
Bad news... does not work. I checked other controls that have an event handler and none are working. The events are not being fired!!! Why only with .Net 2.0 SP2. What a pant load! Why, Why, Why??? So very frustrating.
Please help if you can. Otherwise I have to have one platform for my Web Site de-void of .Net 2.0 SP2 and another platform for all other development. Again, what a pant load! Why me?
0
 
michouisAuthor Commented:
All event handlers broken with .Net Framework 2.0 SP2, can any one help?
0
 
Bob LearnedCommented:
Did you ever test with a new web site?  It might be one of those small configuration settings, or something like that...
0
 
michouisAuthor Commented:
No I did not. I will and will let you know... time is always a constraint... I am using a master page and need to create a new web site with Master page etc.... time, time....
0
 
michouisAuthor Commented:
Ok. Sorry for the delay.

I created a new web site with a master page and default.aspx page that uses the master page. I added a button and.... blah, blah, blah.... it works fine. The event is firing.

I deleted the event handler in my live web site and then double-clicked the button to re-create the event handler but still nothing, will not fire the event in my original Web Site.. I have reviewed the Web.config and tried removong things and saving, building and debugging but still no difference.

I have attached my web.config minus the encryption, tamperproof keys and connection strings. Perhaps you can see/suggest something? My PC will no longer allow me to remove .Net Frameword 2.0 SP2 as it insists other programs will no longer function properly. I used to be able to remove it.... now I am sort of stuck with it. Probably a good thing since I am now forced to resolve this whacky situation.

<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
	<!--<configSections>
		<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
			<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
				<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
				<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
					<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
					<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
					<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
				</sectionGroup>
			</sectionGroup>
		</sectionGroup>
	</configSections> -->
	
	
	<system.web>
		<!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions 
            where data loss can occur. 
            Set explicit="true" to force declaration of all variables.
        -->
		<sessionState timeout="520">
		</sessionState>
		<httpHandlers>
			<add path="Gradient.axd" verb="GET"
			  type="Elsinore.Website.GradientHandler"/>
		</httpHandlers>

		<machineKey decryption="AES" decryptionKey="5B19E5552E8A4E338BFCC02E7D1F632A4E536D56218AE0B6D3777B"/>
	
		<authorization>
		</authorization>
		<identity impersonate="true"/>
		
		<roleManager enabled="true" defaultProvider="CustomizedProvider">
			<providers>
				<clear/>
				<add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
				<add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
				<add name="CustomizedProvider" connectionStringName="Web" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
			</providers>
		</roleManager>
		<membership defaultProvider="CustomizedProvider">
			<providers>
				<clear/>
				<add name="CustomizedProvider" type="System.Web.Security.SqlMembershipProvider, &#xA;System.Web, Version=2.0.0.0, Culture=neutral, &#xA;PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="Web" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Encrypted" maxInvalidPasswordAttempts="10" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/ "/>
			</providers>
		</membership>
		<compilation debug="true" strict="true" explicit="true">
			<assemblies>
				<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
				<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
				<add assembly="ptDotNetSDK20, Version=6.1.0.0, Culture=neutral, PublicKeyToken=57B8CED636E82142"/>

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

		<httpModules>
			<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
		
		</httpModules>-->


		<pages enableViewStateMac="false" enableEventValidation="false"  viewStateEncryptionMode="Never">
			<!--<controls>
				<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
			</controls>-->

			<namespaces>
				<clear/>
				<add namespace="System"/>
				<add namespace="System.Collections"/>
				<add namespace="System.Collections.Specialized"/>
				<add namespace="System.Configuration"/>
				<add namespace="System.Text"/>
				<add namespace="System.Text.RegularExpressions"/>
				<add namespace="System.Web"/>
				<add namespace="System.Web.Caching"/>
				<add namespace="System.Web.SessionState"/>
				<add namespace="System.Web.Security"/>
				<add namespace="System.Web.Profile"/>
				<add namespace="System.Web.UI"/>
				<add namespace="System.Web.UI.WebControls"/>
				<add namespace="System.Web.UI.WebControls.WebParts"/>
				<add namespace="System.Web.UI.HtmlControls"/>
			</namespaces>
		</pages>
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
    
		<authentication mode="Forms">
				  <forms name="ESWeb" path="/" protection="All"  defaultUrl="Home.aspx" slidingExpiration="true" cookieless="UseCookies" timeout="525600" loginUrl="Login.aspx"/>
		</authentication>
		<!--The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.-->

        <customErrors defaultRedirect="GenericErrorPage.htm" >
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>  
	</system.web>
	<system.net>
		
	</system.net>
	

	<!-- <system.web.extensions>
		<scripting>
			<webServices>-->
				<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
				<!--
      <jsonSerialization maxJsonLength="500">
        <converters>
          <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
        </converters>
      </jsonSerialization>
      -->
				<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
				<!--
        <authenticationService enabled="true" requireSSL = "true|false"/>
      -->

				<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
           and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
           writeAccessProperties attributes. -->
				<!--
      <profileService enabled="true"
                      readAccessProperties="propertyname1,propertyname2"
                      writeAccessProperties="propertyname1,propertyname2" />
      
			</webServices>
			
      <scriptResourceHandler enableCompression="true" enableCaching="true" />
      
		</scripting>
	</system.web.extensions> -->

	<system.webServer>
		<httpProtocol>
			<customHeaders>
				<clear />
				<add name="X-UA-Compatible" value="IE=EmulateIE7"/>
			</customHeaders>
		</httpProtocol>
<!--
		<validation validateIntegratedModeConfiguration="false"/>
		<modules>
			<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
		</modules>
		<handlers>
			<remove name="WebServiceHandlerFactory-Integrated" />
			<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
				 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
			<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
				 type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
			<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
		</handlers>-->
		</system.webServer>

	</configuration>

Open in new window

0
 
Bob LearnedCommented:
Did you try temporarily removing the gradient HttpHandler?

<httpHandlers>
   <add path="Gradient.axd" verb="GET" type="Elsinore.Website.GradientHandler"/>
</httpHandlers>
0
 
michouisAuthor Commented:
I just tried that... no difference.

I also created a new web site and added the Web.config and all ASPX pages and code behind from my live web site folder to the new web site folder by using "add existing item", same problem. It is obviously something specific to my live web site since the blank new web site i tried yesterday worked fine. The new blank web site does not have all the config attributes in web.config etc... I guess I will try adding one at a time to see which one causes this problem....  what a time waster :(
0
 
michouisAuthor Commented:
Ok, finally solved!

The problem was that my <form> tag in my MasterPage had attribute "action=Home.aspx". This was the killer. I removed this attribute and all works normally now under .Net Framework 2.0 SP2. Finally! Strange that it did not cause ANY problem under 2.0 SP1, just SP2. Either way, I am GREATLY relieved that this is resolved. Until the next quandry which i am sure there will be....

Thanks for your efforts to help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

  • 8
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now