Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session variables & disabled cookies

Status
Not open for further replies.

steve05

Programmer
Jul 23, 2001
4
AU
Hi, I have an asp page that uses a session variable as a parameter in its sql query. As I understand it, if a user's browser has cookies disabled, the session variable will not work and the page will crash. Is there any way of testing the browser to see if cookies are enabled or not so they can be redirected if necessary?



I've also posted this in the Ultradev forum.
 
Think about putting that variable into a TYPE=HIDDEN field, encrypted if necessary. That way cookies will not matter. The cookie is used to hold a SessionID so that the session can be retrieved on return. I understand that ASP.NET does away with this because Session does not work on a Web Farm where you can not be guaranteed to come back to the machine that is holding the session variables. In ASP.NET, all the Session stuff is sent in the page.
 
the simplest cookie test is to save something and then retrieve it. [for a session variable you need 'Per session' cookies].

session("cookietest") = "COOKIETEST"
if session(&quot;cookietest&quot;) <> &quot;COOKIETEST&quot; then
response.redirect &quot;please_enable_cookie.asp&quot;
response.end
end if

br
Gerard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top