Why does asp.net Response.redirect() work in Visual Studio Debug but fails on the Production IIS server. IIS setting maybe?
I have a an IIS website that has been running since 2015.
But in recent times the QA team have spotted that a Gridview link doesn't redirect to a new page anymore using Response.redirect(). The Response.Redirect() is on the server.
I checked it in Debug mode in the Visual Studio environment and it redirects perfectly using LocalHost on the VS built in Web client.
The only things different between the two environments are
1: It's in debug mode on my development machine.
2: The Production Server is using IIS and my debug environment is using the built in web client.
Maybe you should use a path that starts with "~/". Show some details about Redirect and its effects.
Hi Viorel. The code was working up to three months ago, then something changed either on IIS or the Prod server which stopped the redirect working. Here is the code.
The top bit is an excerpt of the ASPX showing the grid code, and the bottom is the code behind.
Also It works in debug mode within Visual Studio, but is only failing to redirect on the prod server.
What happens on prod. server? (What address is opened in browser?)
The browser does not open to the new page in production IIS. It stays on the old page with the grid. No errors. But the Response.Redirect() is been hit with the correct URL.
In debug on the built in web server on Visual studio it redirects correctly to the new page, but on IIS in Production it just stays on the grid page without an error..
Please clear your browser's cache and try again, can you share what changes happened to the servers? and your configuration information in iis, have you used url rewrite or reverse proxy?
You can useFiddler to view detailed information.
Sign in to comment
Sort by: Most helpful
Thanks for the suggestions but I found the answer.
The Web Pool for the application was changed from Classic to Integrated.
Why would this happen?
This literally stops the Response.Redirect() from redirecting.
Switch back to Classic it redirects again. Switch to integrated and it stops working again.
Sign in to comment