View Single Post
Old 10-26-2012, 08:26 PM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,555
Thanks: 62
Thanked 4,054 Times in 4,023 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Ummm...no, I don't think that will work.

You can't use Request.Cookies to get the cookie you JUST SET using Response.Cookies.

Request.Cookies *ONLY* shows you the cookies that were present at the time the user's HTTP request was made.

So if the cookies were set to "old" and the query string said "new", then Request.Cookies would still be "old" and the query string would NOT take effect until the next time the user got to the page.

Try this:
Code:
IF Request.Querystring("nsmc") = "new" THEN
     Response.Cookies("nsmc")= "new"
     Response.Cookies("nsmc").Expires = Date() + 30
     NEWPAGE
ELSEIF  Request.Querystring("nsmc") = "old" THEN
    Response.Cookies("nsmc")= "old"
    Response.Cookies("nsmc").Expires = Date() + 30
    OLDPAGE
ELSEIF Request.Cookies("nsmc") = "new" THEN
    NEWPAGE
ELSE
    OLDPAGE
END IF
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
DanInMa (10-26-2012)