Cannot use existing session for user integration

Last post 11-30-2006, 4:56 PM by kuljitsingh. 7 replies.
Sort Posts: Previous Next
  •  11-29-2006, 9:20 AM 24665

    Cannot use existing session for user integration

    hi
    i have current user information in session of my portal application. I am following the integration directions of cutechat.
    So in GetUserUniqueName() I am just returning Session["USERID"]. But Session changes when the chat window or messenger window opens.
    So to debug i displayed Response.Write(Session["USERID"] ) in the same method. When the chat windows pops up, it shows me the the correct USERID. Then when it loads chat area in the window, it creates a new session and I loose my userID. Hence "UNKNOWN" user.
    how can I get this thing working?

    Thanks
    Kuljit

  •  11-29-2006, 10:35 AM 24672 in reply to 24665

    Re: Cannot use existing session for user integration

    Kuljit,
     
    Please check your own code. For some reasons, your sesssion is lost when start from a new window or your application force to create a new session in the new window.
     
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  11-29-2006, 12:57 PM 24674 in reply to 24672

    Re: Cannot use existing session for user integration

    i believe integrating applications with our portal environment is a little tricky. Portal does something funky here. When I took my code and unplugged it from portal, Sessions kinda reached the inner window.

    After looking for some help online.. I found this solution for older version on Cutechat. Can you tell me what chnage I need to make for the newer cutechat version since method,version, and public key etc must have changed?

    It is due to an incorrect relative URL. Open CuteSoft_Client\CUteChat\chat.rane.aspx and look for the ProcessRequest function.  Here is what it should look like before you edit it:

     void System.Web.IHttpHandler.ProcessRequest(HttpContext context)
    {
        CuteSoft.Chat.Rane.RaneHandlerFactory.ProcessRequest(context,serviceType);
    }

    Edit it so that it looks like this instead: 

    void System.Web.IHttpHandler.ProcessRequest(HttpContext context)
    {
       CuteSoft.Chat.Rane.RaneHandlerFactory.ProcessRequest(context,serviceType);
        Context.Response.Write(
    "ChatRaneService=cutechatraneobjectbuilder('chat.rane.aspx','CuteSoft.Chat.ChatRaneService,CuteSoft.Chat,Version=2.0.0.0,Culture=neutral,PublicKeyToken=da0fc3a24b6f18ba',['Test','CHSync','CHDisconnect','CHChangeAvatar','CHChangeSkin','CHSetBlockUser','IMSync','IMDisconnect','IMUpdateDescription','IMUpdateStatus','SetBlockUser','AddContact','RemoveContact']);"
        );
    }

     

    This effectively reassigns the ChatRaneService variable to have just "chat.rane.aspx" as the URL, rather than "/ChatApplication/CuteSoft_Client/CuteChat/chat.rane.aspx".  This is a problem because the application was using a URL relative to the root of the remote server rather than relative to the current directory.

  •  11-29-2006, 1:11 PM 24678 in reply to 24674

    Re: Cannot use existing session for user integration

    This is what happens when chat window opens. User ID is in session and i am displaying it in getUseruniquename method.







    CODE:
            public string GetUserUniqueName()
            {
                try
                {
                    Response.Write("<BR><BR>USER ID: " + Session["UserID"].ToString());
                    return Session["UserID"].ToString();
                }
                catch(Exception s)
                {
                    Response.Write("------Error Message: " + s.Message + "--------Stack trace: " + s.StackTrace);
                }
                return null;
            }
  •  11-29-2006, 3:24 PM 24689 in reply to 24678

    Re: Cannot use existing session for user integration

    Before you use the session, you need to check it.
     
    Your code should look like:
     
                public string GetUserUniqueName()
                {
                    try
                    {
                         if (Session["UserID"] != null)
                         {
                               Response.Write("<BR><BR>USER ID: " + Session["UserID"].ToString());
                               return Session["UserID"].ToString();
                         }
                         else
                         {
                            return "Your APP lost the session";
                         }
                    }
                    catch(Exception s)
                    {
                        Response.Write("------Error Message: " + s.Message + "--------Stack trace: " + s.StackTrace);
                    }
                    return null;
                }


    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  11-29-2006, 3:52 PM 24692 in reply to 24689

    Re: Cannot use existing session for user integration

    Ok... but how is this helping.. i loose my session in the inner chat window.. pls see the 2 gray of the following image. one has session and other does not. It looses Session in few seconds!!.

    I am not a flash person. But I belive it boils down to SWF file call where session craps out. Can you pls give me some insight to how/when SWF is calling GetUserUniqueName() method?
    OR
    It has to do with ChatRaneService.... see the following Exception StacK trace:

    ACSChat.Global.GetUserDisplayName(String useruniquename) in c:\inetpub\wwwroot\cutesoft\cutechatplumtreeportlet\global.asax.cs:line 124 at CuteSoft.Chat.DefaultDataProvider.GetUserDisplayName(String useruniquename) at z.GetUserDisplayName(String useruniquename) at CuteSoft.Chat.ChatApiImpl.DoGetUserDisplayName(String uniquename) at CuteSoft.Chat.ChatApiImpl.GetUserDisplayName(String uniquename) at CuteSoft.Chat.UserIdentity.get_DisplayName() at CuteSoft.Chat.ChatService.i() at CuteSoft.Chat.ChatRaneService.Connect(ChatCookie cookie)





    CODE:
    try
                {
                    if (Session["UserID"]!=null)
                    {
                        Response.Write("<BR><BR>I have Session. Time: " + DateTime.Now.ToShortTimeString() + " USER ID: " + Session["UserID"].ToString());
                        return Session["UserID"].ToString();
                    }
                    else
                    {
                        Response.Write("\nI DO NOT have session. Time: " + DateTime.Now.ToShortTimeString());
                        return "Your_APP_lost_the_Session";
                    }
                }
                catch(Exception s)
                {
                    Response.Write("------Error Message: " + s.Message + "--------Stack trace: " + s.StackTrace);
                }
                return null;



  •  11-29-2006, 3:59 PM 24693 in reply to 24692

    Re: Cannot use existing session for user integration

    kuljitsingh,
     
    I think you should check your own code. The stand alone project is an open source project.

    http://chatsample.cutesoft.net/
     
    It uses session as well.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  11-30-2006, 4:56 PM 24736 in reply to 24693

    Re: Cannot use existing session for user integration

    Hi Adam

    Code is written just fine to work as a stand alone aplication. The issue comes when using it with the portal. Here is an insight how our portal environment is setup.

    We have a portal server and another Application server (portlet server). Portal server hosts the Core portal application. And portlet server hosts all the application that run as individual blocks and are placed in portal pages.

    When a client accesses a portal, any request going to application unit residing on portlet server is proxied through the portal server.
    URL looks something like this
    http://portal.com/portal/proxyapplication/http;//portletserver/cutechat/CH_mainform.aspx

    Note there will be two sessions created; 1 on the portal server, 2 from portal to portlet server
    As long as the requests are proxied through the portal like http://portal.com/portal/proxyapplication/http;//portletserver/cutechat/anyASPXorHTMLfile things will work good. But any link in code that is relative to root of the portlet application virtual directory like "/cutesoft_client/cutechat/chat.rane.aspx" will result in error. This is because it will look for http://portal.com/portal/cutesoft/cutechat/chat.rane.aspx path which is basically the portal server and NOT portlet sevrer. Fix is to use link path relative to the current location, like "chat.rane.aspx" or using "../../Login.aspx".

    I think there are links in SWF source code that are reltive to ROOT of cutesoft application. And this is causing problem on our side. We are intersted in your product and would appreciate if you can help us integrating it in our environment.

    Thanks much
    Kuljit

View as RSS news feed in XML