简体   繁体   中英

How to user redirect to the page they were in before auto log out?

I have an asp.net web application where after some minutes of inactivity the user gets logged out automatically from the system. But my client wants me to do something so that after auto log out if they log in again then they are being redirected to the page they were in before the log out. Other wise they said they need to search and get the data again to do everything one more time before logging out. I would appreciate your suggestion regarding this as at this moment I cannot find a way out after googling for long time.

Regards, Thanks.

You can use the property urlReferrer to get the referring webpage url and redirect the page to the same page after the login again. refer to code below.

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        string referrer = Request.UrlReferrer;
        // TODO: do something with the referrer
    }
}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM