Wednesday, July 05, 2006

ASP.NET: Prevent Default Frameset on Refresh or F5

ASP.NET: Prevent Default Frameset on Refresh or F5

Code in Page_Load of Login.aspx (the default main page of the frameset):

string fixFrames=String.Empty;
try
{
if(Session["CurrentPage"].ToString() !="Login.aspx")
{
fixFrames="";
Response.Write(fixFrames);
}
}
catch{}
Session["CurrentPage"]="Login.aspx";


Code in each page to prevent behavior of Refresh or F5 being pressed:

Session["CurrentPage"]="NameofThisPage.aspx";

-- Framesets be damned!