Some tips on how to expire jump pages on the session in ASP.

Source: Internet
Author: User

Here is your own personal essay, for reference purposes only, follow-up better methods to supplement

In the ASPX page, I used to use it when the session expired.

Server.Transfer ("b.aspx");
protected void Page_Load (object  sender, EventArgs e) {if(session["UserId"]= =null) {      Server.Transfer ("login.html");}}

But the bad thing about this is that if the relative path is not in the same folder, then the style will be a problem, and then another way
protected void Page_Load (object  sender, EventArgs e) {if(session["UserId"]= =null)   {Response.Write ("<script>alert" (" you are not logged in, Or login is invalid, please log in again "); top.location.href=". /login.html";</script>");}}

The advantage of jumping with a script is that the relative path does not appear in this folder, and under another path, it can be accessed through scripting

If it is in MVC, then directly specify the route, here is so simple introduction, followed by the MVC inside the session after the expiration of the routing jump to supplement

Some tips on how to expire jump pages on the session in ASP.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.