Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating InfoStore returns "Object Required" error in ASP

Status
Not open for further replies.

chris777

MIS
Jan 3, 2002
228
US
I am new to CE programing (and programing in general) and I am getting an error I can't work through. I can create the session object as well as logon, but when I try to create the InfoStore it get an "Object Required" error. I am running the page as ASP and I have checked the code against an ASP code example and it seems ok. I have pasted my code below, and the error comes at the line:
Set IStore = Sess.Service ("", "InfoStore")


dim APS
dim username
dim password
dim auth
dim SessionManager
dim IStore
dim LogonTokenMgr
dim Sess

APS = Request.Form ("APSName")
username = Request.Form ("username")
password = Request.Form ("password")
auth = Request.Form ("authentication")
Response.Write (APS & ", " & username & ", " & password & ", " & auth)

Set SessionManager = Server.CreateObject ("CrystalEnterprise.SessionMgr")
if err.number <> 0 then
Response.Write (err.Description)
Response.End
end if

Set Sess = SessionManager.Logon(username, password, APS, Auth)
if err.number <> 0 then
Response.Write (err.Description)
Response.End
else
' Response.Write &quot;<br>Session manager successfull&quot;
'Create the InfoStore object.
Set IStore = Sess.Service (&quot;&quot;, &quot;InfoStore&quot;)
'Store the InfoStore object in the session.
Session(&quot;IStore&quot;) = IStore
end if

Set SessionManager = nothing

Chris
DFW Crystal User Group
 
Hi, Try combining the call and the Session assignment:
Code:
SetSession(&quot;IStore&quot;, Sess.Service (&quot;&quot;, &quot;InfoStore&quot;));
The complete code I use for Logon is ( borrowed from Crystal examples):

Code:
function LogonUser(username, password, apsname, authentication) {
	var sm;
	var es;
	var ltm;
	//INSTANTIATE INFOSTORE OBJECT FOR SESSION
    try {
		sm = Server.CreateObject(&quot;CrystalEnterprise.SessionMgr&quot;);
    	es = sm.Logon(username, password, apsname, authentication);
	} catch (e) {
		//LOGON ERROR
		SetCookies_LogonInfo(usr, aps, aut);
		SetSession(&quot;ErrMessage&quot;, e.description);
		Response.Redirect(&quot;logonform.csp?action=logonerror&quot;);
		Response.End();
    }
	SetSession(&quot;IStore&quot;, es.Service (&quot;&quot;, &quot;InfoStore&quot;));
	SetSession(&quot;userID&quot;, username);
	SetSession(&quot;aps&quot;, es.APSName + es.ClusterName);
	try {
		ltm = es.LogonTokenMgr;
	} catch (e) {
		WriteErrorGeneral(e.description);
	}
	//WRITE THE LOGONTOKEN TO A COOKIE AND THE VIEW TOKEN TO A COOKIE
	try {
		SetCookie(&quot;logontoken&quot;, ltm.CreateLogonTokenEx(&quot;&quot;, 480, -1));
	} catch (e) {
		WriteErrorGeneral(e.description);
	}

	//CHECK IF PASSWORD HAS EXPIRED
	if (authentication == &quot;secEnterprise&quot;) {	
		if(es.UserInfo.PasswordExpiry == 0) {
			SetCookies_LogonInfo(username, password, authentication);
			SetSession(&quot;ErrMessage&quot;, L_PASSWORDEXPIRED);
			Response.Redirect(&quot;newpwdform.csp&quot;);
			Response.End();
		}
	}



Hope it is useful..
[profile]
 
Sorry, I am having a hard time converting the JavaScript to ASP. I can't seem to get your suggestion to work.



Chris
DFW Crystal User Group
 
Using Response.write(&quot;<br>&quot; & typename(Sess)) I get a return of &quot;Nothing&quot;. Which seems to mean the variable Sess doesn't refer to anything. Does that mean the logon has failed? If so, shouldn't it return an error?

Arrgggh!


Chris
DFW Crystal User Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top