assume default home page is default.aspx, default first page is default.htm.
default.htm:
<
script type
=
"
text/javascript
"
language
=
"
javascript
"
>
<!--
setTimeout( ' OpenWin() ' , 100 );
function OpenWin()
... {
if(window.parent != null && window.opener == null)
...{
window.parent.location = "Default.aspx";
}
else if(window.opener != null && !window.opener.closed)
...{
window.opener.location = "default.htm"; // recursion to close opener's opener's opener...
window.close();
}
else
...{
window.location = "Default.aspx";
}
}
// -->
</ script >
<!--
setTimeout( ' OpenWin() ' , 100 );
function OpenWin()
... {
if(window.parent != null && window.opener == null)
...{
window.parent.location = "Default.aspx";
}
else if(window.opener != null && !window.opener.closed)
...{
window.opener.location = "default.htm"; // recursion to close opener's opener's opener...
window.close();
}
else
...{
window.location = "Default.aspx";
}
}
// -->
</ script >
code to redirect to default.htm:
private
void
ResponseRidirect()
... {
string currentUrl = this.Request.Url.ToString();
string appPath = this.Request.ApplicationPath;
int index = currentUrl.IndexOf(appPath);
string destUrl = string.Format("{0}/default.htm", currentUrl.Substring(0, index + appPath.Length));
string script = "<script language="javascript" type="text/javascript"> " +
"window.location = "" + destUrl + ""; " +
"</script>";
Response.Write(script);
Response.End();
}
... {
string currentUrl = this.Request.Url.ToString();
string appPath = this.Request.ApplicationPath;
int index = currentUrl.IndexOf(appPath);
string destUrl = string.Format("{0}/default.htm", currentUrl.Substring(0, index + appPath.Length));
string script = "<script language="javascript" type="text/javascript"> " +
"window.location = "" + destUrl + ""; " +
"</script>";
Response.Write(script);
Response.End();
}