ASP.NET: Prevent Default Frameset on Refresh or F5
I never liked frames; I try to avoid them whenever possible. I'm not talking about IFRAMES and other cool DHTML stuff - I mean FRAMESET.
I never liked frames; I try to avoid them whenever possible. I'm not talking about
IFRAMES and other cool DHTML stuff - I mean FRAMESET.
when there are others doing the GUI design for you, and your job is to implement
the ASP.NET functionality within and around it, you're pretty much stuck with
the crap they give you!
One of the bad behaviors with having a
default frameset in ASP.NET is if a user hits the Refresh Icon or presses F5
while they are viewing a specific page in the main frame, guess what happens?
You guessed right! The frameset dutifully reloads, showing the
default pages that it has coded in it - and as Murphy's Law would predict, they
never will include the page the user was viewing!
So here is what
I did for a quick fix:
Code in Page_Load of Login.aspx (the default
main page of the frameset):
=\""+Session["CurrentPage"].ToString() + "\";";
Code in each page to prevent behavior of Refresh or F5 being
-- Framesets be damned!
N.B -- If you have any code
in your Page_Load that checks credentials or does a redirect based on some condition,
make sure you set the Session["CurrentPage"]
after this code.
Otherwise, you may have set up circular references that won't look very friendly...
Submission Date: 9/23/2005 3:22:20 PM
Submitted By: Peter Bromberg
My Home Page: http://www.eggheadcafe.com
By Peter Bromberg Popularity (1835 Views)