CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

SmartNavigation and Redirect (not !) again

Some things just happen twice. I had been battling smart-navigation before. Trying to redirect from code on a page with smart-navigation switched on can lead to blank browser screens. The solution was to set smart navigation to false first before making the redirect. In some recent code I had forgotten about this and back were the troubles.

The bad thing is that it doesn't show up until the actuel user hits it. No problems with the code on my XP localhost. No problems when the sa (Running a localhost account ....) tried the app on the W2K production server. Blank screens when the domain user hits the page.

The easy way out is the smartnavigation tag in the aspx file.

<%@Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false" Inherits="ProjektManager.Projekten" smartNavigation="True"%>

The sa can update that with notepad, asp.net will recompile the page. And the user can work again. Without smartnavigation on that particular page. Things could be worse :>

Peter

 



Comments

Peter van Ooijen said:

hi,

My point is that you want smartnavigation in most roundtrips of the page. But it will turn against you in case you do redirect.
Don't forget the page object is re-created on _every_ roundtrip.
# June 2, 2004 6:41 AM

Vrushali said:

Hi,
So what is the exact solution for redirecting the page when we use Smart navigation? Do we have to explicitly set it off before redirecting the page or what?please explain.
# October 24, 2005 1:30 AM

pvanooijen said:

It's the pagelifecycle !

You can use smartnavigation. But before issuing a redirect from code you have to switch it off. It will stay off for the remainder of handling _that_ request. On the next roundtrip/request it will be on again.

It's the pagelifecycle !
# October 24, 2005 4:25 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!