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.