OnClick events not firing under IIS, works perfectly under VS2010 - asp.net

I have a situation where all client OnClick events have stopped working when the code is hosted under IIS, yet work perfectly when run in the VS2010 environment.
The page is a simple ASPX page with one textbox and one linkbutton on, the linkbutton OnClick calls an event handler btnMyButton_Click.
When run under IIS, the event handler is never called (I have stepped through the code to determine this) but the page is posted. When run under VS2010, the event handler is called as wanted.
The IIS environment is Windows 7, IIS 7.5, ASP.Net 4.0 with an integrated AppPool.
This has also been verified on a Windows Server 2008 R2 server, again with IIS 7.5, ASP.Net 4.0 and an integrated AppPool.
I have tried turning off Event Validation for the page, no dice.
Does any one have any ideas?
Edited to add: Ok, some significant new info. The issue is down to how you visit the page:
http://mydomain.com/SomeFolder/ <- when visited using this url, the OnClick events do not fire
http://mydomain.com/SomeFolder/Default.aspx <- when visiting using this url, everything works as normal

And the answer to this one is simple, but quite buried :)
I had "runAllManagedModulesForAllRequests" set to true in the system.Webserver modules block in the web.config.
Even tho I had no modules defined (just http handlers), it was still causing issues - set it to false and normal service resumed.

In my case, it was a bad IIS configuration (I removed them all and now it works):

Related

Postback is not firing when I click on the submit button, works fine on the server

Locally when I am in running my asp.net webforms application the submit button all of a sudden stopped posting back.
So my onClick events do not fire, and Page.IsPostBack is always false.
When I push the code to my server, everything works fine.
I tried running it in both IIS express and setting up a website locally in IIS, the result is the same.
What could the problem be?
I don't see any javascript errors in chrome console either, but it is working in production so that shouldn't be the issue.
The issue was that I had made an update to the web.config to enforce secure cookies, and when I did running the application locally caused the no post back behaviour.
My guess is that the asp.net session cookie was not able to be saved, so the postback was also not working.
The change I made was:
<httpCookies requireSSL="true" />

Ajax control not working after postback

I am having a developed application and everything works perfectly in visual studio 2010 in local machine.but when I deploy my application in IIS7 classic pool mode, the ajax controls are working fine initially.But once postback is happening none of the of Ajax controls are working?
Please help me in this.
What do you mean by none of them are working?
Shot in the dark, you are likely removing and reloading dom elements that you bound to events previously. Once the new dom elements are loaded you will need to rebind any events such as click to them at that point.

Safari, ASP.NET 4, and LinkButton

I have an ASP.NET Web Application using .NET Framework 4 and it is working fine on all browser when I test it locally using my Visual Studio Pro 2010, but when we deploy it to our server (IIS7 on Windows Server 2008 R2), the LinkButtons of my Web Application is not working correctly on Safari Browser on all platforms.
What was happening was when the LinkButton has a function that uses Response.Redirect, it somewhat clears the session or doesn't save it. I can check this since when I redirect to another page, I save the values inputted to a session first before redirecting, and validate it to the redirected page and if there's no session, bring it back to the previous page.
I have already implemented this fix to add a .browser file to my webapp but it doesn't fix my problem. I also tried this answer from SO to add a Page_PreInit and a configuration but to no avail.
My IIS Configuration has enabled for both Session and Cookies, and I honestly do not see why it will only affect Safari Browser if it is a server configuration error.
I've been working on this bug for a whole day and I can't still fix this. Please help, thanks in advance.
Update: I forgot to mention that my website is inside an iframe, after researching further I have found this question that says that Safari doesn't allow Third-Party Cookie by default. Now I can't use the said fix since my application is in ASP.NET not in PHP.

asp.net webpage defaultDocument button click not firing

I have developed an asp.net website in VS2010. The defaultDocument is set to default.aspx in the root directory, as I have dome many times before.
For reasons unknown an asp:button in default.aspx is not firing correctly when the url is typed in without the file extension.
For example, if I type the url www.mywebsite.com the default.aspx page will load as expected, however, the button will not fire (it does postback but doesn't fire the server click event).
If i type in the url www.mywebsite.com/default.aspx it works as expected.
The problem I'm having only occurs in a live environment (I cannot recreate the error on the localhost).
Any idea's?
Sorted this out last night. It turned out it was an HttpModule of the Telerik web controls I use, in the web.config.
RadCompression... (or something similar). It compresses and cleans up code after an ajax response.
I have no idea why it was affecting the defaultDocument only, but removing it solved my problem.

What can cause ASPNET AJAX page to revert to normal ASPX mode ? / UpdatePanel broken

I am using VS 2008 with a very simple UpdatePanel scenario.
But i cannot get UpdatePanel to work and cant seem to find out why
I have in fact reverted to a very simple example to validate it is not my code:
http://ajax.net-tutorials.com/controls/updatepanel-control/
In this example I click on either button and both text links update.
I dont get any errors, the page just behaves like a normal ASPX page.
What things do i need to check. I've been googling this for an hour and not found what I need.
Edit: Works in Visual Studio web server but not in IIS
If it's working locally, but not when deployed to a remote server, that usually indicates that you're using ASP.NET 2.0 and the ASP.NET AJAX extensions aren't installed on the remote server.
If it's a server you have administrative control over, you can download the installer here: http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en
If it's a web host, tell them to get their act together.
Another option would be to check your web.config. You could for example create an new Ajax enabled ASP.NET website from Visual Studio. This will generate a correct web.config. Copy over all non-ajax sections from your existing web.config and you're set. This worked for me.
-Edoode

Resources