[thelist] [ASP] cookie question

Stephen Caudill SCaudill at municode.com
Wed Feb 26 10:58:22 CST 2003


Ken Schaefer wrote:
> When the user next comes back to the site, I don't see what you can't
> do:
>
> <%
> strRedirect = Request.Cookies("Homepage")
> strParams = Request.Cookies("OptionalParams")
>
> Select Case strRedirect
>     Case "FirstHomePage"
>         Response.Redirect("/somesite/")
>     Case "SecondHomePage"
>         Response.Redirect("/someothersite/default.asp?" & strParams)
> End Select %>

Thanks for replying Ken, I was beginning to think that I was the only one that ever saw my posts.  Unfortunately because of the way the site is structured (using a bastardized version of the FuseBox methodology that calls all content into the index page based on querystring parameters) your method did not work.  I have figured it out though and I thought I would post the solution in case anyone was interested.

<%
'home = 1 is the parameter used to set the cookie
home = int(request("home"))
if home = 1 then
	response.Cookies("homepage") = "onlineCodes"
	response.Cookies("homepage").expires = "01/01/04"
end if

'nav=2&id=1 specifies the content for the page the cookie value redirects to
if request("nav") = 2 and request("id") = 1 then
	session("online") = True
	session.timeout = 60
end if

'creating this session was how I got around the redirect loop
if Session("online") <> True then
	homepage=request.Cookies("homepage")
	if homepage = "onlineCodes" then
		response.Redirect("index.asp?nav=2&id=1")
	end if
end if
%>

So, thar she blows.  The page in question is at:
http://neohero.municode.com/fusion/index.asp?nav=2&id=1


Thanks,
Stephen Caudill




More information about the thelist mailing list