Search code examples
asp.netfirefoxsessioncookiesswfupload

ASP.NET Help! FireFox is eating my cookies!


IE works fine, but FireFox does not.

I am setting a cookie on my default.aspx page:

    HttpCookie hc = new HttpCookie("guid", guid.ToString());
    hc.Expires = DateTime.Parse("12/12/2010");
    Response.Cookies.Add(hc);

My upload control (I'm using SWFUpload) submits to upload.aspx.

On upload.aspx I call:

    if (Request.Cookies["guid"] != null)
    {
       // Do something.
    }

...my cookie only contains my ASP.NET session variable. Any ideas?


Solution

  • I have had the same issue when trying to upload files in Firefox through my Flex application. If you're also using Flash, you may want to do what I did; if you're using the HTML controls, this may or may not apply.

    What I did to work around the Firefox issue is issue a one-time use token on the server, then post that token when doing the upload (for example, it could be a hidden field in the form). If the token is recognized upon upload, the upload is processed, then the token is expired. So it's basically what you're doing, only without using a cookie.