Response.Redirect Draws a Blank

Found a nasty little bug in ASP.NET 1.1 this morning. Once again I’m documenting it for my personal archives and the Googlers.

This one results from using a combination of Response.Redirect, SmartNavigation and secure (HTTPS) connections. The page in question was designed to save changes, then redirect to the original calling page, so the contents of the event called from the Save button did something like:

SaveData();
Response.Redirect( myCallingPageURL );

This worked perfectly on the dev box, but when migrated to the test machine, it resulted in a blank page, with the address still set to the original page. Debug output proved that the Response.Redirect call was being made correctly. The only difference was that the test machine was configured to use SSL (HTTPS), and the dev machine was not.

After a bit of Googling, I found the answer right here. The culprit was the SmartNavigation property on the page. SmartNavigation, when set to true, is a nifty little add-on that makes page updates very smooth in Internet Explorer. You don’t get a visible page refresh, and some Javascript jiggery-pokery is used to make post-backs almost transparent. Very nice when you’re designing for an IE-only corporate client (shudder).

BUT, SmartNavigation seems to bugger up Response.Redirect when using a HTTPS connection, as we witnessed. Thankfully the solution is pretty simple, and does not require disabling SmartNavigation for the whole page life. You just need to do it prior to calling the Response.Redirect like so:

SaveData();
this.SmartNavigation = false;
Response.Redirect( myCallingPageURL );

That simple addition will turn off the javascript stuff for the single callback that results in the redirect. Problem solved!

6 Replies to “Response.Redirect Draws a Blank”

  1. The same problem I have expirienced with SmartNavigation.
    The problem is not in .NET itself but in .NET instalation.
    The .NET was not installed properly. For SmartNavigation feature to work your web site must have aspnet_client directory.
    Run “ASPNET_REGIIS.EXE -c” from %WINDIR%\Microsoft.NET\Framework\v1.1.4322\ to install client side scripts requierd for SmartNavigation.
    The problem has occured becouse the .NET Framework was installed before IIS.

  2. Thanks for the comment – certainly not having the .NET client-side scripts installed can cause all sorts of problems, but that was not the cause for this particular problem. We definitely had the client-side scripts installed.

    The first thing I tried was to reinstall the client scripts, but that did not help. Disabling smart navigation before the redirect was the only solution (when using https).

Leave a Reply

Your email address will not be published. Required fields are marked *