ASP.NET帮助! Firefox是吃我的饼干! [英] ASP.NET Help! FireFox is eating my cookies!

查看:118
本文介绍了ASP.NET帮助! Firefox是吃我的饼干!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IE浏览器工作正常,但Firefox没有。

IE works fine, but FireFox does not.

我是我Default.aspx页面上设置一个cookie:

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);

我的上传控件(我用的SWFUpload)提交给upload.aspx。

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

在upload.aspx我打电话:

On upload.aspx I call:

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

...我的cookie仅包含我的ASP.NET会话变量。任何想法?

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

推荐答案

我曾试图通过我的Flex应用程序上传在Firefox文件时,同样的问题。如果您还使用闪光灯,你可能想要做什么,我做;如果您使用的HTML控件,这可能会或可能不适用。

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.

我所做的来解决Firefox的问题是发布在服务器上的一次性使用的令牌,然后做上传的时候张贴标记(例如,它可能是在形式的隐藏字段)。如果令牌是在上传的认可,上载处理,那么该令牌已过期。所以基本上你在做什么,只是不使用Cookie。

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.

这篇关于ASP.NET帮助! Firefox是吃我的饼干!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆