View Single Post
Old 10-26-2012, 05:04 PM   PM User | #1
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
serve new home page based on variable or no variable

OK, i havent worked with asp and cookies together before. I have a new page design and an old one. the html is contained in 2 subs, SUB OLDPAGE and SUB NEWPAGE.

This is what Im trying to do

- user goes to www.mysite.com/ and gets OLDPAGE by default


- user goes to www.mysite.come/?nsmc=new . I want to then set a cookie for 30 days storing the cookie "nsmc" as equaling "new" , then user gets NEWPAGE

- user goes to www.mysite.com/ ( nsmc cookie shoudl now equal new) and serves NEWPAGE


- user goes to www.mysite.com/?nsmc=old - then set cookie nsmc to "old and serve OLDPAGE

on subsequent visits to www.mysite.com user will again get OLDPAGE




ok, so this is what I have


Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%

IF Request.Querystring("nsmc") = "new" THEN
Response.Cookies("nsmc")= "new"
ELSEIF  Request.Querystring("nsmc") = "old" THEN
Response.Cookies("nsmc")= "old"
END IF
Response.Cookies("nsmc").Expires = Date() + 30
IF Request.Cookies("nsmc") = "new" THEN
NEWPAGE
ELSE
OLDPAGE
END IF

SUB NEWPAGE
 %>
<p> this is my new page design</p>

<% 
END SUB 
SUB OLDPAGE
%>

<p>this is my old page<p>

<% END SUB %>
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote