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!

SessionManager.Logon and CE9

Status
Not open for further replies.

MaddogC

Programmer
Dec 4, 2003
134
GB
I have a standard logon.csp page that contains the following code:

Dim Sess
Set Sess = SessionManager.Logon (UserName,Password,APSName,AuthType)

If Err.Number <> 0 then
Response.Write "Logon has failed"
Else
'Do my logon bit.....
End if

If the user types in their password incorrectly, an error is thrown and the user redirected to a try again page.

However if the user enters their username incorrectly, but their password correctly the SessionManager.Logon does not throw an error, but simply fails to logon and leaves me with a blank screen. How can I trap the error?
 
Hi, Does your logon page use the Try..Catch method to trap errors, like this one used by CE:
Code:
function LogonUser(username, password, apsname, authentication) {
	var sm;
	var es;
	var ltm;
	//INSTANTIATE INFOSTORE OBJECT FOR SESSION
    try {
		sm = Server.CreateObject("CrystalEnterprise.SessionMgr");
    	es = sm.Logon(username, password, apsname, authentication);
	} catch (e) {
		//LOGON ERROR
		SetCookies_LogonInfo(usr, aps, aut);
		SetSession("ErrMessage", e.description);
		Response.Redirect("ce10_logonmulti.csp?action=logonerror");
		Response.End();
    }
	SetSession("IStore", es.Service ("", "InfoStore"));
	SetSession("userID", username);
	SetSession("aps", 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("logontoken", ltm.CreateLogonTokenEx("", 480, -1));
	} catch (e) {
		WriteErrorGeneral(e.description);
	}

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

It should catch any Login error not just password problems..

[profile]
 
fraid not, it's written in classic ASP (CSP) against CE9.
 
Strange. I'm not an ASP guy, so I would implement this as per Turkbear.
It's a bit clunky, but maybe you could try something like:

If Err.Number <> 0 or ((Not IsObject(Session("IStore"))) or (isNull(Session("IStore")))) Then
Response.Write "Logon has failed"
Else
'Do my logon bit.....
End if

Kingfisher [CECP]
 
HI,
The sample code I posted is CSP...( Can be converted to ASP easily though)and should work with 9 or 10 ( the file names for the redirect are exemplar only, yours would of course differ).

[profile]
 
Sorry, what I mean is the CSP page is written using VB script and asp version 3.0, which doesn't support the try.. catch terminology.

I would need to rewrite your function with the 'on error goto' terminology in vbscript. However the .Net object model will be different than the one i'm using.

The end result however is that the error trapping is not picking up the incorrect username.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top