To download the CSP files from this tutorial, click TutorialSamples.zip. For more information, see Code examples.
<META HTTP
<link REL=STYLESHEET TYPE='text/css' HREF='tut.css'>
<!-- #include file=helper_js.csp -->
var UserID, Password, APS, Aut;
//Retrieve the user information from the form
APS = Request.QueryString.Item("APS");
UserID = Request.Form.Item("UserID");
Password = Request.Form.Item("Password");
Aut = Request.Form.Item("Aut");
//Create an Enterprise SessionManager.
SessionManager = Server.CreateObject("CrystalEnterprise.SessionMgr");
Response.Write ("Couldn't create SessionManager");
//Log the user on to Crystal Enterprise.
Sess = SessionManager.Logon(UserID, Password, APS, Aut);
//Check to see if logon failed.
//If the logon failed, show a message box with an error description.
Response.Write ("<SCRIPT language=\"javascript\"> " +
" alert (\"Sorry - you could not be logged on to " +
"this server. Ensure that your user name and " +
"password, as well as the APS name are correct. " +
//Redirect the user back to the logon page.
Response.Write ("<META HTTP
//Create the InfoStore object.
IStore = Sess.Service ("", "InfoStore");
//Store the InfoStore object in the session using the helper functions.
//Retrieve the LogonTokenManager.
LogonTokenMgr = Sess.LogonTokenMgr;
//Retrieve a Logon Token and store it in the user's cookie file for later use.
SetCookie("LogonToken",LogonTokenMgr.CreateLogonTokenEx("", 60, 100));
//Redirect the user to the site's home page.
Response.Write("You have been logged on to Enterprise");
Response.Redirect ("Home.csp
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |