CookieLoginValue
The CookieLoginValue
returns the initial cookie value to be used when first accessing a
cookie protected directory
See the ASPocxSamples\ACookieLogin sub-directory of the installation directory
for a working sample.
See Also
CookieLoginCookieName
Syntax
CookieLoginValue(SERVER_NAME, SCRIPT_NAME, Username, Password)
Parameters
-
SERVER_NAME
-
Server name, see example
-
SCRIPT_NAME
-
AuthentiX ISP: The path of the directory that is protected, relative to the web root.
AuthentiX: The absolute path of the directory that is protected.
-
Username
-
The Username collected by the login form.
-
Password
-
The Password collected by the login form.
Return Values
Returns the initial cookie value to be used when first accessing a
cookie protected directory.
Example
Use a form like this to collect the user data:
collect.htm
<HTML>
<HEAD>
<TITLE>Login</TITLE>
</HEAD>
<FORM METHOD="POST" ACTION="loginNow.asp">
<H1> Login using Cookie based Authentication </H2>
<PRE>
Enter your username: <INPUT SIZE=30 NAME="username" MAXLENGTH=200>
<P>
Enter your password: <INPUT SIZE=30 NAME="password" MAXLENGTH=200>
<P>
</PRE>
<INPUT TYPE=submit VALUE=" OK ">
</BODY>
</HTML>
</FORM>
<FONT SIZE=3>
<P>
</FONT>
</BODY>
</HTML>
Then collect the data, pass to AuthentiX to
get the CookieLoginValue, and redirect to the
protected pages, like so:
(Note the use of the underbar character (_) to continue a long line)
loginNow.asp
<%
usingAuthentiXStandard = true
if (usingAuthentiXStandard) then
Set AuthX = Server.CreateObject("AUTHXOCX.AuthXOCXCtrl.1")
else
Set AuthX = Server.CreateObject("AUTHXISP.AuthXOCXCtrl.1")
protectedDomain = Request.ServerVariables("LOCAL_ADDR")
'protectedDomain = "hostheader.com"
AuthX.SetVirtualDomain protectedDomain, Request.ServerVariables("SCRIPT_NAME")
AuthX.SetVirtualDomainPassword("")
end if
protectedDirectory = "/ACookieLogin/members/"
protectedAbsPath = "c:\ACookieLogin\members\"
serverName = Request.ServerVariables("LOCAL_ADDR") ' target server IP
redirectTo = "/ACookieLogin/members/index.htm"
cookieName = AuthX.CookieLoginCookieName(protectedAbsPath, _
protectedDirectory _
)
cookieValue = AuthX.CookieLoginValue(serverName, _
protectedAbsPath, _
Request.Form("USERNAME"), _
Request.Form("PASSWORD") _
)
response.Cookies(cookieName) = cookieValue
response.Cookies(cookieName).Path = protectedDirectory
response.redirect redirectTo
' Note: you can't just change the value of a cookie
' that has a path. You must also set the path again
' with you change the value of the cookie.
%>
Applies To
AuthentiX OCX Component
http://www.flicks.com/authentix/discover/main.htm