Export (0) Print
Expand All

Login.asp Code for the Retail Solution Site

Commerce Server 2002

Following is the code for the Login.asp page for the Retail Solution Site. If you choose to use AuthFilter for the Retail site, you must use this code for your site Login.asp. For more information, see Enabling AuthFilter for the Retail Solution Site.

<!-- #INCLUDE Virtual="retail/include/header.asp" -->
<!-- #INCLUDE Virtual="retail/include/const.asp" -->
<!-- #INCLUDE Virtual=" retail/include/html_lib.asp" -->
<!-- #INCLUDE Virtual="retail/include/form_lib.asp" -->
<!-- #INCLUDE Virtual="retail/include/std_access_lib.asp" -->
<!-- #INCLUDE Virtual="retail/include/std_profile_lib.asp" -->
<!-- #INCLUDE Virtual="retail/include/std_cookie_lib.asp" -->
<!-- #INCLUDE Virtual="retail/include/std_url_lib.asp" -->
<!-- #INCLUDE Virtual="retail/include/std_util_lib.asp" -->
<!-- #INCLUDE Virtual="retail/include/setupenv.asp" -->
<!-- #INCLUDE Virtual="retail/template/no_menu.asp" -->

<%
REM sample file for using with AuthFilter
REM This file handles Login for user
%>

<%

   Sub Main()
   End Sub
   
   Dim strSelect, strUsername, strPassword, strPWD, retAsp
   dim objAuth
   Dim strAuthErr, strSiteName, sUserID
   
   set objAuth = Server.CreateObject("Commerce.AuthManager")
   strSiteName = CStr(Application("MSCSCommerceSiteName"))
   objAuth.Initialize(strSiteName)
   
   'Get the hidden variable to determine if this is the first run of the page
   strSelect = Request.Querystring("realSubmit")
   
   'If users pressed the submit button
   if strSelect = "fromButton" then
      'authenticate the user
      strUsername = Request.Querystring("txtUsername")
      strPassword = Request.Querystring("txtPassword")
      
         if (strUsername = "") or (strPassword = "") then
            Response.Redirect "Login.asp"
         end If
         
         Set mscsUserProfile = GetUserProfileByLoginName(strUsername)
         if (mscsUserProfile is nothing) then
            Response.Redirect "Login.asp"
         end if
         
         if (mscsUserProfile.Fields("GeneralInfo.user_security_password").Value = strPassword) then
            sUserID = mscsUserProfile.Fields(GetQualifiedName(GENERAL_INFO_GROUP, FIELD_USER_ID)).Value
            ' for Custom/NT Auth
            objAuth.SetAuthTicket sUserID, 1, 90 
         
            ' Go to the Original requested ASP which is stored in cookie MSCSFirstRequestedURL"
            retAsp = Request.Cookies("MSCSFirstRequestedURL")
            if (retAsp = "" Or IsNUll(retAsp)) then
            retAsp = objAuth.GetURL("default.asp", True, False)
            end if
            Response.Redirect retAsp
         else
            Response.Redirect "Login.asp"
         end if
   else
      PrintLogin
   End if
  Set objAuth = Nothing
  Set strUserName = “”
  Set strPassword = “”
  Set strPWD = “”
%>

<%Sub PrintLogin() %>
<HTML>
<HEAD>
<TITLE>Login</TITLE>
</HEAD>
<BODY>
<FORM NAME="frmLogin" ACTION="Login.asp" METHOD="GET">
<br>
<br>
<br>
<H2 ID=L_LoginForm_HTMLText>CS2K-LoginForm</H2><ID Id=L_EnterCredential_ErrorMessage>
To access authenticated content, please enter your UserID & Password</ID>
<br>
<br>
<br>

<H3 ID=L_UserName_HTMLText>Username:<INPUT TYPE="text" NAME="txtUsername" SIZE=32 MAXLENGTH=32><br><ID ID=L_UserPassword_HTMLText>
Password :</ID>
<INPUT TYPE="password" NAME="txtPassword" SIZE=32 MAXLENGTH=32></H3><br>
<br>

<INPUT type=HIDDEN name="realSubmit" value="fromButton">
<p align="left">
   <input type="submit" name="action" id=L_Submit_Button value="Submit">
   <input type="reset" name="action" id=L_Reset_Button value="Reset"> 
</p>
</FORM>

<H4>
<br>
<br>
<%
REM SOLUTION SITES: Retail
REM    need to add own registration file under '\AuthFiles\' sub-Dir Or 
Copy ..\Retail\login\newuser.asp to '\AuthFiles\newuser.asp'
REM    in global.asa update: dictPages.NewUser = "AuthFiles/newuser.asp"
REM
%>
<A HRef="newuser.asp" ID=L_RegisterIf_HTMLText>Register if you are a new user 
   (solution sites: need to add own registration file under '\AuthFiles\' sub-Dir Or 
Copy ..\Retail\login\newuser.asp & update NewUser-File in Global.asa)</A>
<br>
</H4>

</BODY>
</HTML>
<%end sub%>

See Also

Enabling AuthFilter for the Retail Solution Site

Copyright © 2005 Microsoft Corporation.
All rights reserved.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft