How redirect to custom page after Session Timed out. There is error showing after session timedout :-
Directory Listing -- /
Thanks & Regards
Jagatpal Singh
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Chandradev PrasadPosted Apr 25, 2014, 6:43 AM
Just Now i was testing your problem in my local i got one very simple way to fix your problem,
Step 1: Add this code in webconfig file like this. Note for testing i have kept 1 min
Step 2: You can keep this code in master page code behind like this
public int SessionLengthMinutes
{
get { return Session.Timeout; }
}
public string SessionExpireDestinationUrl
{
get { return "Home.aspx"; }
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
this.Page.Controls.Add(new LiteralControl(
String.Format("",
SessionLengthMinutes * 60, SessionExpireDestinationUrl)));
}
You can try this code in your application.
Chandradev PrasadPosted Apr 25, 2014, 6:12 AM
http://vijaymeghwal.wordpress.com/2012/08/29/detecting-session-timeout-and-redirect-to-login-page-in-asp-net/
let me know, if your problem will not solve.
sudipta sanyalPosted Apr 25, 2014, 4:53 AM
{
}
else
{
Response.Redirect("your_custom_page.aspx");
}
Abhineet SrivastavaPosted Apr 25, 2014, 4:52 AM
Please use this in your page load event.