When doing it in the early stage, the login method was easily done using ajax. Before logging in, it was judged whether there was a value in the session. If it existed, there was no need to log in; if it did not exist, the login page would pop up to log in. Since I'm using ff browser, I haven't found any problems. When I submitted it to users last week, I was shocked that it said it was invalid after logging in with IE. The result is really like this. . Very embarrassing
The login code is as follows:
Copy the code code as follows:
//Query from the server whether session exists
j.ajax({
type:GET,
url:sessioncheck.asp,
data:,
timeout: 1000,
error: function(){
alert('sorry, server is busy now!');
},
success:function(comments_data){
if(comments_data == 1){
el.createDialog(opts);
j.startOver();
}
else{
var sql = selectSQL(searchkey,stype);
window.location.href = sql;
}
}
});
It's roughly like this. Sessioncheck.asp is nothing more than checking the session. The code is as follows:
Copy the code code as follows:
if session(username) = then
Response.Write(1)
else
Response.Write(2)
end if
The result is that the session (username) of IE is useless, and the timeout setting is useless.
I checked online for a long time and found that there were quite a few similar problems. Finally, I found the cause: cache problem.
When asynchronous get is obtained, if the URL remains unchanged, the information in the cache is directly called, which will result in the value in the session not being obtained.
The solution is very simple, clear a lot of Google asp cache.
Finally, a paragraph was added to sessioncheck.asp, as follows:
Copy the code code as follows:
Response.Buffer =True
Response.ExpiresAbsolute =Now() - 1
Response.Expires=0
Response.CacheControl=no-cache
if session(username) = then
Response.Write(1)
else
Response.Write(2)
end if