最好以确定是否饼干在启用ASP.NET的方式? [英] Best way to determine if cookies are enabled in ASP.NET?

查看:110
本文介绍了最好以确定是否饼干在启用ASP.NET的方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是确定一个用户的浏览器中启用ASP.NET饼干的最佳方法

What is the best method for determining if a users browser has cookies enabled in ASP.NET

推荐答案

设置一个cookie,强制重定向到一些检查页面,并检查Cookie。

Set a cookie, force a redirect to some checking page and check the cookie.

或设置每个页面加载一个cookie,如果它尚未设置。举例来说,我想这是检查是否饼干的支持,当他们尝试登录,他们需要启用Cookie显示一条消息。您的登录cookie设置为来宾用户的一些默认值,如果他们没有Cookie集呢。那么你的登录页面上,检查用户的cookie,如果没有设置,然后显示您的消息。

Or set a cookie on every pageload, if it's not already set. For instance, I assume this is to check if cookies are supported to display a message when they try to login that they need to enable cookies. Set your login cookie to some default value for guest users if they don't have the cookie set yet. Then on your login page, check for the user cookie, and if it's not set, then display your message.

这篇关于最好以确定是否饼干在启用ASP.NET的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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