Two different behaviors when redirecting from an updatepanel
I have a simple repeater inside an UpdatePanel in my ASP.NET page. This repeater has a button in every RepeaterItem than, when clicked, will redirect you to another page based on the information contained in that particular RepeaterItem. Nothing out of the ordinary until that point.
In my development computer when I click one of these buttons I get a response from the ajax call that looks like
and everything works like it should. I'm guessing the script manager handles that directive and sends the browser via JS to somepage.aspx?q=bla.
When I deploy this to my actual website (dedicated server, I really try to keep the same configuration in both enviroments, including using IIS in my development computer) this behaviour changes. When I click on one these buttons I get a 302 Found response from the server and the HTTP headers include a
directive. What ends up happening is that the browser (FF, chome, IE) handle both pages (meaning the ajax call and they do a GET from page I'm trying to redirect to) but only the original page is rendered, so no redirection takes place. The 2nd page is loaded but in "the background" and never shown.
I'm trying to found the reason behind these 2 different behaviours. From what I could find by googling around is that this might be a configuration error (for example, see this question) but my configuration is the same in both servers. Keep in mind that I cant mess around too much with the actual website so right now I'm trying to make my development server to act like the production server so I know where this difference is coming from and then take the proper actions.
Any help will be appreciated.
Sending a 302 redirect response back from an ajax request doesn't work because the redirect won't happen. So ASP.NET Ajax intercepts any redirect on the server side, converts it into a status code 200 and then it does the 'redirect' manually on the client side (using window.location).
For some reason the ASP.NET Ajax (ScriptModule) isn't converting your 302 response correctly when it's deployed. My best guess is that it doesn't think it's an ajax request - to decide whether it's an ajax request it looks to see if it contains a "X-MicrosoftAjax: Delta=true" header. Check to see if this header is being received on the server side of your deployed site.