I tried like below many methodes some are responding resource not found and some are reloading same page unlimited time.
ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('test 9'); window.location='" + HttpRuntime.AppDomainAppPath + "/LoginPage.aspx';", true);
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ScriptKey", "alert('Your session timed out.');window.location='../LoginPage.aspx'; ", true);
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Your session timed out');window.location.href ='../LoginPage.aspx';", true);
it works for me in chrome
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('test 9'); window.location='../Login.aspx';", true);
}
Statement like below will work, I have tested it. In this each "../" is one step back folder. In my example "CustomerLogin.aspx" is in the 2 folder back from the current page
You can put break point in Global.asax file or actual url being constructed to get exact file location generated.
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "redirect", "alert('PWD');location.href='../../CustomerLogin.aspx'", true);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.