[thelist] [ASP] cookie question

Stephen Caudill SCaudill at municode.com
Tue Feb 25 13:51:01 CST 2003

  I am trying to create a cookie that when set, at the users request, will change their default homepage on our site.  i.e. instead of hitting index.asp, if the cookie is set then they receive /folder/file.asp as their initial page.  The reason being that 90% of the traffic to our site goes directly to a specific page (public access to info we host for clients) and it would significantly reduce the amount of tech support our company has to do trying to tell john q how to get to a page that is always one click away... bleh.
  I've run into a couple of hitches with this and its probably because I'm a newbie to ASP.  First, the site uses one page for the layout and calls in different content based on variables in the query string.  As you are likely aware, the code for cookies must come before the <html> tag, and as there is only one <html> tag in the whole site, I was a bit flummoxed at first, so I came up with this code:

home = int(request("home"))
if home = 1 then
response.Cookies("homepage") = "onlineCodes"
response.Cookies("homepage") = "01/01/04"
end if
if homepage = "onlineCodes" then
end if

this is assuming that on the online codes page, there would be a button which would post an additional parameter in the querystring which is home=1 if the user would like that to be their default page on our site.  The BIG problem being, once this cookie is set, you get stuck in a response.redirect loop.  I need to ensure that only the first time per session the user hits the site, they are redirected there.  Any ideas on what is a good way to do this?  I'm reading up on the session object right now, but would like to know if I'm barking up the wrong tree.

Thanks In Advance,
Scuba Steve

for those curious:
and if you want to see the nifty infinite loop (in IE, but not Mozilla, cause it rox)

More information about the thelist mailing list