单点登录 Webservice

     public static UserSession GetUserSession(HttpRequestBase request)
        {
            try
            {
                SougeWebService.UserVerificationWebService webserver = new SouGeForum.SougeWebService.UserVerificationWebService();
                if (webserver.CookieContainer == null)
                {
                    webserver.CookieContainer = new System.Net.CookieContainer();
                    SessionStateSection section = (SessionStateSection)WebConfigurationManager.GetSection("system.web/sessionState");
                    string session_cookie_name = section.CookieName;
                    webserver.CookieContainer.Add(new Uri(webserver.Url), new System.Net.Cookie(session_cookie_name, request.Cookies[session_cookie_name].Value));
                }
                return webserver.GetUserSession();
            }
            catch
            {
                return null;
            }
        }

        public static UserSession GetUserSession(HttpRequest request)
        {
            try
            {
                SougeWebService.UserVerificationWebService webserver = new SouGeForum.SougeWebService.UserVerificationWebService();
//SougeWebService 应用Souge if (webserver.CookieContainer == null) { webserver.CookieContainer = new System.Net.CookieContainer(); SessionStateSection section = (SessionStateSection)WebConfigurationManager.GetSection("system.web/sessionState"); string session_cookie_name = section.CookieName; webserver.CookieContainer.Add(new Uri(webserver.Url), new System.Net.Cookie(session_cookie_name, request.Form[session_cookie_name])); } return webserver.GetUserSession(); } catch { return null; } }

 

posted @ 2013-04-02 13:28  南潇湘  阅读(596)  评论(2编辑  收藏  举报