I am using uploadify to upload files, they automatically post to the handler. I then modify the session with the handler that I had setup as a static property in a common class of the website. I then try to access the same session of the ASPX page, and the value is null. I have a feeling this is because of the cookie, but there needs to be a-to-work around this without exposing the sessioni The d in the URL.
Solutions
I found the Answer:when the handler is being called from FLASH (like SWFUpload or uploadify) it does don't pass the current SessionID to the handler. The handler then creates a NEW session. To fix this, do the following:
$ (Selector). Uploadify ({ ' uploadify.swf ', ' Upload.ashx? Aspsessid=<%=session.sessionid%> ' });
ADD To:Global.asax:
1 voidApplication_BeginRequest (Objectsender, EventArgs e)2 {3 Try4 {5 stringSession_param_name ="Aspsessid";6 stringSession_cookie_name ="Asp.net_sessionid";7 stringSession_value = Request.form[session_param_name]??Request.querystring[session_param_name];8 if(Session_value! =NULL) {Updatecookie (session_cookie_name, Session_value);}9 }Ten Catch(Exception) {} One } A - voidUpdatecookie (stringCookie_name,stringcookie_value) - { theHttpCookie cookie =HttpContext.Current.Request.Cookies.Get (cookie_name); - if(Cookie = =NULL) - { -HttpCookie Cookie1 =NewHttpCookie (Cookie_name, cookie_value); + Response.Cookies.Add (cookie1); - } + Else A { atCookies. Value =Cookie_value; - HttpContext.Current.Request.Cookies.Set (cookie); - } -}
If you have form validation, continue to view http://stackoverflow.com/questions/14465314/ how-to-access-session-in-aspx-that-was-modified-in-ashx#comment20148862_14465314