Monday, January 24, 2011

Javascript for Redirect to login page from pop up of pop up after session out

1.Write this javascript in header section of aspx page.
<script language="javascript" type="text/javascript">
function(mstrLoginURL)
{
window.close();
if(window.opener &&  !window.opener.close)
{
window.opener.location.reload(true);
}
}
</script>

2.write this code in .cs page on page load
if(Session["CID"].ToString() == null )
{
string mstrLoginURL = ResolveUrl("Login.aspx");
Page.ClientScript.RegisterStartupScript(this.GetType(), "aa", "closepopup('" + mstrLoginURL + "')", true);
}


Hope this help you.

No comments:

Post a Comment