Click here to Skip to main content
15,936,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);
Posted
Comments
Resource not found means that path of the page is wrong.
dawood abbas 20-Jun-15 6:31am    
so how to give path which is out side of the folder?
dawood abbas 20-Jun-15 6:33am    
http://localhost:10562/Admin/~/LoginPage.aspx

Server Error in '/' Application.

The resource cannot be found.

1 solution

Use Server.MapPath to get the exact path to the login page in ScriptManager.RegisterStartupScript or ScriptManager.RegisterClientScriptBlock method.

Server.MapPath("~/LoginPage.aspx")
 
Share this answer
 
Comments
dawood abbas 20-Jun-15 6:41am    
where to write it? in under qoutes or "+Server.MapPath("~/LoginPage.aspx")+" like this
Sreekanth Mothukuru 20-Jun-15 7:01am    
try this

ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Your session timed out');window.location ='"+ Server.MapPath("~/LoginPage.aspx") +"';", true);
dawood abbas 20-Jun-15 7:13am    
its not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900