Custom UserAdaptor - access to Session Variables

Last post 04-29-2005, 3:08 PM by temi. 5 replies.
Sort Posts: Previous Next
  •  04-13-2005, 10:52 AM 5683

    Custom UserAdaptor - access to Session Variables

    Hi,

    I have developed a Custom provider to integrate Cutechat within our Database User Schema. On the whole it went well and I was able to follow your documentation well but one issue did arise.

    In the UserAdaptor class while implementing the GetUserUniqueName method I found that the HttpContext did not always contain the Session object. Originally we had some user information set in Session Variables (As opposed to User.Identity) but I found that the Session variable were perfectly accessible except for the chat page itself when the Session was null.

    I assumed this was because here you are using some kind HttpHandler to do the actual chat protocal - is it here that the Session variables are lost ? I have had previous issues with this as Implementing a HttpHandler does not by default give access to the Session Variables unless one implements the marker interface IRequiresSessionState.

    I was able to get round this by using the Forms based authentication and getting a User.Identity etc.. I just wondered if access to the Session could be provided, it would still be useful to myself in the custom provider.

    Many thanks again

    Richard Stockley

  •  04-13-2005, 11:56 AM 5686 in reply to 5683

    Re: Custom UserAdaptor - access to Session Variables

    Richard Stockley :
     
    The CuteChat2 support Session.
     
    But there is a bug that , the page's constructor try to get the user identity , while the Session state is not a acquired .
    (IHttpHandler constructor is before the asp.net step AcquireRequestState)

    I will fix that as soon as possible .

    (make sure the web.config contains <sessionState mode="InProc" />) 
    Regards , Terry .
  •  04-28-2005, 4:24 PM 6265 in reply to 5686

    Re: Custom UserAdaptor - access to Session Variables

    When do you plan to fix this problem? Im having the same problem, but why do the other custom implementations not have this problem? ( I think of DotNetNuke and IBuySpy....) ?
     
    Brgds
  •  04-29-2005, 6:19 AM 6277 in reply to 6265

    Re: Custom UserAdaptor - access to Session Variables

    Here is a workaround the missing Session problem:
    On the webpage before you like to automatic login to the chat, you need to add the nick to the HttpContext.Items collection. Because the context is ok, it is the context.Session, that is the problem. In your custom implementation of the UserAdapter, you need to check if the context.Session==null, if it is, then use the context.Items collection to retrieve the nick.
     
    Still hoping to here about the resize of the chat?
    Brgds
  •  04-29-2005, 11:48 AM 6304 in reply to 6277

    Re: Custom UserAdaptor - access to Session Variables

     
    Regards , Terry .
  •  04-29-2005, 3:08 PM 6315 in reply to 6304

    Re: Custom UserAdaptor - access to Session Variables

    Thx for the tip, but I stick to the code I made, because that will allways return the right username...and it is implemented now ;-)
     
    But Im sure I will come up with more questions soon, but it is looking good now.
     
    Thx for all your support
     
    Brgds
View as RSS news feed in XML