Asp.Net MVC Custom Principal losing information

Asp.Net MVC Custom Principal losing information

Old forum URL: forums.lhotka.net/forums/t/10757.aspx


RandyH posted on Monday, October 10, 2011

If I have a user "A" logged in, then when user "B" pulls up the site (without logging in), then user "A" custom identitiy properties are lost. This also occurs if both users are logged in and one of the users logs out.

The custom pricipal object is being stored in session. Session is being maintained by Asp.Net Session State Service.

    Private Sub ShellApplication_AcquireRequestState(ByVal sender As ObjectByVal e As System.EventArgsHandles Me.AcquireRequestState
        If (TypeOf HttpContext.Current.Handler Is IRequiresSessionStateThen
            If (Csla.ApplicationContext.AuthenticationType = "Windows"Then
                Exit Sub
            End If
 
            Dim principal As System.Security.Principal.IPrincipal
            Try
                principal = CType(Session(SessionKey.CslaPrincipal), System.Security.Principal.IPrincipal)
            Catch
                principal = Nothing
            End Try
 
            If (principal Is NothingThen
                If User.Identity.IsAuthenticated AndAlso TypeOf User.Identity Is FormsIdentity Then
                    formsAuth.SignOut()
                End If
 
                PHGTPrincipal.Logout()
            Else
                ' use the principal from Session
                Csla.ApplicationContext.User = principal
 
            End If
 
        End If
 
    End Sub
I am using CSLA 4.1. I have csla.dll, csla.web.dll, and csla.web.mvc.dll referenced in my projects.
Any help would be GREATLY appreciated!

RockfordLhotka replied on Monday, October 10, 2011

Maybe this thread would help:

http://forums.lhotka.net/forums/t/10673.aspx

Copyright (c) Marimer LLC