Am not sure why when using IE, retrieving session values works just fine, but when using Google Chrome and Firefox, it's not returning any?
I have already included IRequiresSessionState/IReadOnlySessionState in generic handler class, but still did not work.
So my last resort was to add my session values as a query string in generic handler.
But I still want to know why and what's wrong in Chrome and Firefox? Thanks.
UPDATE: here's the way I handle my Seesion SessionManager
It works perfectly in ASPX pages and in IE, Chrome, and Firefox
but when used in my ASHX page. sample code below
<%@ WebHandler Language="C#" Class="Upload" %> using System; using System.Web; using System.Web.SessionState; using System.IO; public class Upload : IHttpHandler, IReadOnlySessionState { SessionManager sm; public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Expires = -1; sm = new SessionManager(); try { HttpPostedFile postedFile = context.Request.Files["Filedata"]; string uploadedas = string.Empty; if (context.Request.QueryString["as"] != null) { uploadedas = context.Request.QueryString["as"]; } string username = sm.Username; string sessionid = sm.SessionID; // // MORE CODES HERE // context.Response.Write(response); context.Response.StatusCode = 200; } catch (Exception ex) { context.Response.Write("Error: " + ex.Message + "\r\n\r\n" + ex.StackTrace); } } public bool IsReusable { get { return false; } } }
sm.Username and sm.SessionID returns an emptry string when Chrome and Firefox is used.. but as I said earlier, those are working perfectly in ASPX pages even in different browsers.