Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Multiple Session Count when using auto-log in .net

Hi! We created a page that will automatically log a user on to InfoView using the following code I found on one of Ted's posts:

Sub Page_Load(sender as Object, e as EventArgs)

Dim ceSessionMgr As New SessionMgr()

Dim ceSession As EnterpriseSession

Dim username As String = "Administrator"

Dim password As String = ""

Dim cmsname As String = "TUEDA-BEXIR2"

Dim authtype As String = "secEnterprise"

Dim hostname As String = "tueda-bexir2"

ceSession = ceSessionMgr.Logon(username, password, cmsname, authtype)

Dim MyIdentityCookie As New HttpCookie("IdentityCookie", ceSession.LogonTokenMgr.DefaultToken)

MyIdentityCookie.Path = "/"

Response.Cookies.Add(MyIdentityCookie)

Response.Redirect("http://" & hostname & "/businessobjects/enterprise115/InfoView/logon.aspx")

End Sub

It logs on fine except when I look at the Session Count for the user it shows 2 instead 1. When the user logs off, only 1 sessions goes away and I have to wait for the other one to time out. As you can imagine this is causing us trouble with the number of user licenses, especially if a user logs on and off several times.

Any idea as to why 2 sessions would be created? Should we redirect to the main.aspx page instead of the logon.aspx page?

Thanks,

Cyndi

replied

That's because the failover token (DefaultToken) is being used. Alternative way would be to generate a logon token, then log off the session that created it:

ceSession = ceSessionMgr.Logon(username, password, cmsname, authtype)
Dim MyIdentityCookie As New HttpCookie("IdentityCookie", ceSession.LogonTokenMgr.CreateLogonTokenEx("", 10, 10))
MyIdentityCookie.Path = "/"
Response.Cookies.Add(MyIdentityCookie)
ceSession.Logoff()
Response.Redirect("http://" & hostname & "/businessobjects/enterprise115/InfoView/logon.aspx")

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question