可以利用SessionId在查找Session解决问题

Global.asax 文件中,添加如下代码

  1. void Application_BeginRequest(object sender, EventArgs e)  
  2. {  
  3.     try  
  4.     {  
  5.         string session_param_name = "ASPSESSID";  
  6.         string session_cookie_name = "ASP.NET_SESSIONID";  
  7.   
  8.         if (HttpContext.Current.Request.Form[session_param_name] != null)  
  9.         {  
  10.             UpdateCookie(session_cookie_name, HttpContext.Current.Request.Form[session_param_name]);  
  11.         }  
  12.         else if (HttpContext.Current.Request.QueryString[session_param_name] != null)  
  13.         {  
  14.             UpdateCookie(session_cookie_name, HttpContext.Current.Request.QueryString[session_param_name]);  
  15.         }  
  16.     }  
  17.     catch (Exception)  
  18.     {  
  19.     }  
  20.   
  21.     try  
  22.     {  
  23.         string auth_param_name = "AUTHID";  
  24.         string auth_cookie_name = FormsAuthentication.FormsCookieName;  
  25.   
  26.         if (HttpContext.Current.Request.Form[auth_param_name] != null)  
  27.         {  
  28.             UpdateCookie(auth_cookie_name, HttpContext.Current.Request.Form[auth_param_name]);  
  29.         }  
  30.         else if (HttpContext.Current.Request.QueryString[auth_param_name] != null)  
  31.         {  
  32.             UpdateCookie(auth_cookie_name, HttpContext.Current.Request.QueryString[auth_param_name]);  
  33.         }  
  34.   
  35.     }  
  36.     catch (Exception)  
  37.     {  
  38.     }  
  39. }  
  40.   
  41. void UpdateCookie(string cookie_name, string cookie_value)  
  42. {  
  43.     HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(cookie_name);  
  44.     if (cookie == null)  
  45.     {  
  46.         cookie = new HttpCookie(cookie_name);  
  47.         HttpContext.Current.Request.Cookies.Add(cookie);  
  48.     }  
  49.     cookie.Value = cookie_value;  
  50.     HttpContext.Current.Request.Cookies.Set(cookie);  
  51. }   

请求页面需要传递参数

  1. Server.UrlEncode(string.Format("?ASPSESSID={0}", Session.SessionID))  

    如果有多个参数,Server.UrlEncode是必须的,在flash里使用&的非法的,必须要进行一次URL编码

    比如 :Server.UrlEncode(string.Format("?OrderId={0}&ASPSESSID={1}", OrderId, Session.SessionID))  

 

      flashUpload.QueryParameters = string.Format("ASPSESSID={0}", Session.SessionID); 

 

转载自:http://blog.csdn.net/gnl8/archive/2010/03/11/5370060.aspx