Cookie|cookies always have new portable questions about cookies, here I find a good article, you share.
==================================================
When a developer uses the session variable, the client browser must be required to support receiving cookies, and when the ASP starts a session, it sends a cookie to the client with a label (SessionID). Through this sign, The ASP will then be able to confirm the session and therefore maintain the status. So, before you use the session variable, you need to confirm that the cookie is accepted. Here I explain two methods:
Method One:
Whenever you are between two pages, there is a very simple and reliable way: request a SessionID on the first page, pass it to the next page. Compare the SessionID to the page request. The same description of the client browser accept cookies, the difference is not accepted. It's very simple.
For example, you can put one on the first page (hidden field) and write the SessionID to it. After submitting, remove the SessionID from the page data. Like this:
<form name= "Form1" method= "post" action= "sessions2.asp" >
Username:<input name= "UserName" ><br>
Password:<input name= "UserPassword" >
<input type= "hidden" name= "Thesessionid" value= "<%=Session.SessionID%>" ><br>
<input type= "Submit" value= "Submit" >
</form>
On the second page we will judge whether the SessionID is the same.
<%
Dim Thesessionid
Thesessionid = Request.Form ("Thesessionid")
If Thesessionid = Session.SessionID Then
"When they are equal, the cookie function opens
Response.Write "Cookie is turned on"
Else
"If they are equal, the cookie feature is turned off
Response.Write "Cookie doesn't open!"
End If
%>
Method Two:
You can also use this method to first write a cookie in a page, such as:
<%
Response.Cookies ("status") = "Onoroff"
%>
Read this cookie on the second page:
<%
If Request.Cookies ("status") = "" Then
"When Cookies (" status ") do not have a value, the cookie function is not turned on
Response.Write "Cookie doesn't open!"
Else
"When Cookies (" status ") have a value, the cookie function opens
Response.Write "Cookie is turned on"
End If
%>