Freigeben über


Button events not firing over NLB

I have seen many blogs and a lot of articles that talked about how to use in-process sessions or viewstate over load balancing. 90 out of 100 such articles come talking about the MachineKey attribute in the machine.config file. The <machineKey> element is used to control tamper proofing and encryption of ViewState, forms authentication tickets, and role cookies. I faced an issue that falls under the rest 10%.

The other day I got a case from one of my customers stating that he was clicking on one of the submit buttons in his ASPX page, but he didn’t see the postback happening in the page. He was clicking the button and nothing happened!! It was happening with just one of the buttons on this page, other buttons work fine on other pages. However the application didn’t have any coding issues, we checked the app on non-NLB machines and it worked fine. The customer had four servers in NLB.

When I heard the problem description, the first thing that came to my mind was the machineKey element. So used the article How to create keys by using Visual C# .NET for use in Forms authentication and created a new machineKey and had it added on all four servers. Now the button click event started working on one of the servers, but still failed on the rest three. Here starts the real test. I took one of the three non-working server and these were my findings,

Ø The button was declared as follows

<input type="submit" name="btnSubmit" value="Submit" onclick="javascript:return ValidateNull();if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="btnSubmit" title="Submits Your Profile" class="button" />

Ø I checked that the validation files are updated to the latest version (c:\Inetpub\wwwroot\aspnet_client\system_web\1_1_4322).

Ø I then checked that the button is declared in the code file and also the EventHandler is attached to it.

Ø To my surprise, the validations in this page are executed fine.

Ø I made sure that all the servers are having the same version of .NET Framework (1.1.4322.2300)

Pretty much exhausted with my entire action plan. I then thought that let me re-register the client files before I move forward. So I performed aspnet_regiis -c and did an IISRESET to fix the issue. So though the client files were showing the recent timestamp, they had to be registered! After making it work on this machine, we ran the command in other 2 servers and everything is working fine now.

SOME USEFUL ARTICLES:

How To: Configure MachineKey in ASP.NET 2.0

https://msdn2.microsoft.com/en-us/library/ms998288.aspx

How to create keys by using Visual C# .NET for use in Forms authentication

https://support.microsoft.com/?id=312906

Troubleshooting the "View State is invalid" error with ASP.NET

https://support.microsoft.com/?id=829743