<%@ LANGUAGE=VBScript %>
<% Option Explicit %>
<!--#include virtual="/NR/Shared/ASPUtils.inc"-->
<%
'SetCookie.asp: Sets the authentication cookie and redirects to the next page.
'	Expects 2 parameters:
'	- ReturnUrl: The page to redirect to after setting the cookie.
'	- CMSAUTHTOKEN: The authentication token to insert into the cookie.

Response.Buffer = True
Response.Expires = 0

Response.Cookies("CMSAUTHTOKEN").Path = "/"
Response.Cookies("CMSAUTHTOKEN") = Request.QueryString("CMSAUTHTOKEN")

' Redirect to next URL, indicating that a cookie has been set.
Dim strReturnUrl
Dim strRedirectToUrl

strReturnUrl = Request.QueryString("ReturnUrl")

if ( InStr( strReturnUrl, "?" ) > 0 ) Then
	strRedirectToUrl = strReturnUrl & "&SetCookie=True"
else
	strRedirectToUrl = strReturnUrl & "?SetCookie=True"
end if

Call ServerSideRedirect( strRedirectToUrl )
%>
