Session variable getting lost using Firefox, works in IE

Posted by user328422 on Stack Overflow See other posts from Stack Overflow or by user328422
Published on 2010-04-29T01:22:55Z Indexed on 2010/04/29 1:27 UTC
Read the original article Hit count: 454

I am setting a Session variable in an HttpHandler, and then getting its value in the Page_load event of an ASPX page. I'm setting it using

    public void ProcessRequest(HttpContext context)
    {
        HttpPostedFile file = context.Request.Files["Filedata"];
        context.Session["WorkingImage"] = file.FileName;
    }

(And before someone suggests that I check the validity of file.FileName, this same problem occurs if I hard-code a test string in there.) It's working just fine in IE, but in Firefox the Session Variable is not found, getting the "Object reference not set to an instance of an object" error in the following code:

   protected void Page_Load(object sender, EventArgs e)
   {
        string loc = Session["WorkingImage"].ToString();
   }

Has anyone encountered this problem - and hopefully come up with a means for passing the session variable?

© Stack Overflow or respective owner

Related posts about aspx

Related posts about session-variables