可以利用SessionId在查找Session解决问题
Global.asax 文件中,添加如下代码
- void Application_BeginRequest(object sender, EventArgs e)
- {
- try
- {
- string session_param_name = "ASPSESSID";
- string session_cookie_name = "ASP.NET_SESSIONID";
- if (HttpContext.Current.Request.Form[session_param_name] != null)
- {
- UpdateCookie(session_cookie_name, HttpContext.Current.Request.Form[session_param_name]);
- }
- else if (HttpContext.Current.Request.QueryString[session_param_name] != null)
- {
- UpdateCookie(session_cookie_name, HttpContext.Current.Request.QueryString[session_param_name]);
- }
- }
- catch (Exception)
- {
- }
- try
- {
- string auth_param_name = "AUTHID";
- string auth_cookie_name = FormsAuthentication.FormsCookieName;
- if (HttpContext.Current.Request.Form[auth_param_name] != null)
- {
- UpdateCookie(auth_cookie_name, HttpContext.Current.Request.Form[auth_param_name]);
- }
- else if (HttpContext.Current.Request.QueryString[auth_param_name] != null)
- {
- UpdateCookie(auth_cookie_name, HttpContext.Current.Request.QueryString[auth_param_name]);
- }
- }
- catch (Exception)
- {
- }
- }
- void UpdateCookie(string cookie_name, string cookie_value)
- {
- HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(cookie_name);
- if (cookie == null)
- {
- cookie = new HttpCookie(cookie_name);
- HttpContext.Current.Request.Cookies.Add(cookie);
- }
- cookie.Value = cookie_value;
- HttpContext.Current.Request.Cookies.Set(cookie);
- }
请求页面需要传递参数
- 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