UserControls_HeaderMenu (user-defined control, the following is the code to display the user login status)
if (Session[“user_id”] != null)
{
User user = new User();
user.LoadData(Convert.ToInt32(Session[“user_id”]));
LabelHello.Text = “Hello,” + user.LoginName + ““;
LinkButtonLogin.Text = “Leave”;
}
else
LinkButtonLogin.Text = “Login”;
A piece of code for the user login interface:
if (user.Exist) //If the user exists
{
if (user.Password == password) //If password, go to the message list page
If (Request.QueryString[“in”] == null) //Not jumping from within the system
Response.Redirect(“BookList.aspx”);
else//It jumps from within the system
Response.Write(“”);
}
If you are not logged in, first enter the book browsing interface, and then click Login to enter the login interface. I hope to jump back to the book browsing interface after logging in, but after using history.go(-2) to jump back, the logged in status cannot be displayed. Login . Please give me some advice, thank you! ! !
8 solutions
#1
It must not be displayed. History.go(-2); displays your operations 2 times ago from the COOKIE, and it will definitely not be displayed after login. . .
#2
history.back() means going back to the last history page.
history.go(-1) indicates the first page of recent history
history.go(-2) represents the second page of recent history
#3
Give Lou The main piece of code will enable you to jump after logging in. .
This is usually done
If you judge that you are not logged in on the error.aspx page, you will
Response.Redirect( “http://www.sina.com.cn?returnUrl=http://www.sina.com.cn/error.aspx “);
After someone logs in, you can judge whether there is a returnurl and if so, return to this page and it will be OK.
#4
history.go(-2) In fact, it is the same as clicking the back button of your browser. You can try to see if it refreshes when you click it.
You must send a request to the server again to refresh the login status.
#5
This retuHow should rnurl be obtained? It is uncertain which page the user enters first. How to determine which page he entered before logging in?
What is the difference between history.back() and history.go(-1)?
#6
Javascript:The difference between history.go() and History.back()
http://yefei.javaeye.com/blog/333368
#7
request.QueryString[“url”] value
Response.Redirect(request.QueryString[“url”]);
#8
Get to landing page Just the URL will do. . . . . . Landlord. . . . .
Remember the URL of the requested page and pass it to the login page as a parameter. When the login is successful, jump to the obtained URL.
string url=HttpContext.Current.Request.Url.ToString();