如何检测cookie是否已启用?

编程入门 行业动态 更新时间:2024-10-26 22:24:32
本文介绍了如何检测cookie是否已启用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在网上到处搜索,但找不到一个简单的例子 检测是否启用了cookie - 在服务器端,并且没有移动 从一个页面到另一个页面。 这应该是一个非常基本的功能,所以我不愿意相信 那里没有简单地在服务器端脚本中测试它的方法。 任何人? Thx, Agoston

Hi, I searched around everywhere on the net, but could not find a simple example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be a very basic functionality, so I am reluctant to believe that there''s no way to simply test it in a server-side script. Anyone? Thx, Agoston

推荐答案

AFAIK no。你必须测试这个客户端(它可能在同一页面上 ,具体取决于客户端方法究竟是什么惹恼你)。 Patrice - " Agoston Bejo" <顾*** @ freemail.hu> écritdansle message de news:%2 **************** @ TK2MSFTNGP10.phx.gbl ... AFAIK no. You have to test this client side (it could be on the same page depending on what exactly annoys you with client side methods). Patrice -- "Agoston Bejo" <gu***@freemail.hu> a écrit dans le message de news:%2****************@TK2MSFTNGP10.phx.gbl... 我在网上到处搜索,但找不到一个简单的检测是否启用了cookie的例子 - 在服务器端,并且没有从一个页面移动到另一个页面。 这应该是一个非常基本的功能,所以我不愿意相信,没有办法在服务器端脚本中测试它。任何人? Thx, Agoston Hi, I searched around everywhere on the net, but could not find a simple example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be a very basic functionality, so I am reluctant to believe that there''s no way to simply test it in a server-side script. Anyone? Thx, Agoston

" Agoston Bejo" <顾*** @ freemail.hu>在消息中写道 新闻:#H ************** @ TK2MSFTNGP10.phx.gbl ... "Agoston Bejo" <gu***@freemail.hu> wrote in message news:#H**************@TK2MSFTNGP10.phx.gbl... 检测是否启用了cookie的示例 - 在服务器端,并且没有从一个页面移动到另一个页面。这个应该是一个非常基本的功能,所以我不愿意相信,没有办法在服务器端脚本中简单地测试它。任何人? Thx , Agoston Hi, I searched around everywhere on the net, but could not find a simple example of detecting if cookies are enabled - on server side, and without moving from one page to another. This should be a very basic functionality, so I am reluctant to believe that there''s no way to simply test it in a server-side script. Anyone? Thx, Agoston

" ...检测是否启用了cookie - 在服务器端...... 您是否询问如何检测客户端cookie是否通过 服务器端ASP启用? " Response.Cookies"被定义为包含所有 值的集合将在当前响应中发送回客户端的cookie。 " Request.Cookies时"定义为从用户系统发送的所有 cookie的值及其请求的集合。 因此,我认为这样可行: Response.Cookies(" aCookie")=" Hello World" Response.Write"是客户端的已启用Cookie? = &安培; (不是 IsEmpty(Request.Cookies(aCookie))) 但它返回True即使Cookies已被禁用。

"... detecting if cookies are enabled - on server side ..." Are you asking how to detect if client-side cookies are enabled via server-side ASP? "Response.Cookies" is defined as "A collection containing the values of all the cookies that will be sent back to the client in the current response.". "Request.Cookies" is defined as A collection of the values of all the cookies sent from the user''s system along with their request." Thus, I thought that this would work: Response.Cookies("aCookie") = "Hello World" Response.Write "Are client-side cookies enabled? = " & (Not IsEmpty(Request.Cookies("aCookie"))) But it returned "True" even when Cookies were disabled.

McKirahan于2005年10月10日在 microsoft.public.inetserver.asp.general写道: McKirahan wrote on 10 feb 2005 in microsoft.public.inetserver.asp.general: 检测是否启用了cookie - 在服务器端,并且没有从一个页面移动到另一个页面。 但这是一个愚蠢的期望。 因此,我认为这样可行: Response.Cookies(" aCookie")=" Hello World" Response.Write"是否启用了客户端Cookie? = &安培; (不是 IsEmpty(Request.Cookies(aCookie))) 但它返回True即使Cookies已被禁用。 detecting if cookies are enabled - on server side, and without moving from one page to another. But that is a silly expectation. Thus, I thought that this would work: Response.Cookies("aCookie") = "Hello World" Response.Write "Are client-side cookies enabled? = " & (Not IsEmpty(Request.Cookies("aCookie"))) But it returned "True" even when Cookies were disabled.

您如何在不联系客户的情况下期望服务器了解客户端, ? 你将不得不求助于这样的事情: 1.asp: <% Response.Cookies(" aCookie")=" Hello World" Response.redirect" 2.asp" %> ; 2.asp: <% 如果会话(aCookie)=" ; Hello World然后 Response.Write" Cookies Enabled" Else Response.Write" Cookies disabled" 结束如果 %> - Evertjan。 荷兰。 (用我的电子邮件地址替换所有带点的十字架)

How do you expect the server knowing anything about the client, without contacting the client? You will have to resort to something like this: 1.asp: <% Response.Cookies("aCookie") = "Hello World" Response.redirect "2.asp" %> 2.asp: <% If Session("aCookie") = "Hello World" Then Response.Write "Cookies Enabled" Else Response.Write "Cookies Disabled" End If %> -- Evertjan. The Netherlands. (Replace all crosses with dots in my emailaddress)

更多推荐

如何检测cookie是否已启用?

本文发布于:2023-10-24 17:31:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524566.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:cookie

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!