asp.net 4.5 cookie在Chromium OS中不起作用

时间:2013-06-29 12:49:41

标签: cookies chromium asp.net-4.5

我无法 Google Chromium OS 从ASP.NET 4.5页面设置/读取Cookie。

我在Windows 8上使用IIS 8.

以下是简单的Web表单示例:

<%@ Page Language="VB" %>

<!DOCTYPE html>

<script runat="server">

    Protected Sub Page_Load(sender As Object, e As EventArgs)

        If Not IsPostBack Then

            Dim cookie As New HttpCookie("TestCookie")
            cookie.Expires = Date.UtcNow.AddDays(1)
            cookie.Value = "Hello from Cookie!"
            Response.Cookies.Add(cookie)

        End If

    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs)

        Dim cookie As HttpCookie = Request.Cookies("TestCookie")
        If Not IsNothing(cookie) Then
            Label1.Text = cookie.Value
        Else
            Label1.Text = "Cookie not found!"
        End If

    End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

    </div>
    </form>
</body>
</html>

当我点击按钮阅读cookie时 - 它总是返回Nothing(找不到cookie)

我已检查我的Cookie设置已在Chromium中启用。

当我检查Chromium设置以查看存储的cookie时,它仅列出我网站域中的 ASPNET会话ID cookie,因此它存储会话cookie。

还有其他人遇到过这个问题吗?

我在Windows 8上使用IIS 8.

0 个答案:

没有答案