asp.net中使用uploadify插件上传文件, session中的值丢失的问题
2021-06-04 04:04
标签:rms tps already asa null tpc lob obj cookie 工作中遇到使用uploadify插件上传文件后,后台代码中的session[XXX]值为null的问题,反复跟踪,发现不是值丢失,而是sessionID发生了变化,而引起SessionID发生变化的原因就是因为使用了uplodify插件 解决方法: $("#uploadifyLogo").uploadify({ Global.asax 文件 if (HttpContext.Current.Request.Form[session_param_name] != null) try if (HttpContext.Current.Request.Form[auth_param_name] != null) private void UpdateCookie(string cookie_name, string cookie_value) 原文地址: https://www.cnblogs.com/xust/articles/3522367.html http://stackoverflow.com/questions/1729179/uploadify-session-and-authentication-with-asp-net-mvc asp.net中使用uploadify插件上传文件, session中的值丢失的问题 标签:rms tps already asa null tpc lob obj cookie 原文地址:https://www.cnblogs.com/spaceMM/p/12343990.html
...
formData: { ASPSESSID: ASPSESSID, AUTHID: auth }
});
protected void Application_BeginRequest(object sender, EventArgs e)
{
/* we guess at this point session is not already retrieved by application so we recreate cookie with the session id... */
try
{
string session_param_name = "ASPSESSID";
string session_cookie_name = "ASP.NET_SessionId";
{
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 { }
{
string auth_param_name = "AUTHID";
string auth_cookie_name = FormsAuthentication.FormsCookieName;
{
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 { }
}
{
HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(cookie_name);
if (null == cookie)
{
cookie = new HttpCookie(cookie_name);
}
cookie.Value = cookie_value;
HttpContext.Current.Request.Cookies.Set(cookie);
}
文章标题:asp.net中使用uploadify插件上传文件, session中的值丢失的问题
文章链接:http://soscw.com/index.php/essay/90242.html