如果禁用cookie,并asp.net存储的cookie作为会话cookie而不是或不? [英] if cookies are disabled, does asp.net store the cookie as a session cookie instead or not?

查看:119
本文介绍了如果禁用cookie,并asp.net存储的cookie作为会话cookie而不是或不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,如果cookeis是在客户端上禁用的,我想知道是否这...

basically, if cookeis are disabled on the client, im wondering if this...

dim newCookie = New HttpCookie("cookieName", "cookieValue")

newCookie.Expires = DateTime.Now.AddDays(1)

response.cookies.add(newCookie)

通知我设定一个日期,所以应该存储在磁盘上,如果禁用cookie并asp.net自动存储这个cookie作为一个会话cookie(这是一个cookie,持续在浏览器内存中,直到用户关闭浏览器,如果我没有记错)......还是asp.net一点都没有(任何地方),在这种情况下,我将不得不添加cookie重新添加cookie来收集无日期(存储作为一个会话cookie)当然......,这需要我做加法的cookie的两倍......也许第二次不必要的,如果它被存储在浏览器内存反正...我只是尽量不存放两倍,它只是坏$ C $Ç!任何想法如果我需要编写另一行不? (这将是)...

notice i set a date, so it should be stored on disk, if cookies are disabled does asp.net automatically store this cookie as a session cookie (which is a cookie that lasts in browser memory until the user closes the browser, if i am not mistaken).... OR does asp.net not add the cookie at all (anywhere) in which case i would have to re-add the cookie to the collection without the date (which stores as a session cookie)... of course, this would require me doing the addition of a cookie twice... perhaps the second time unnecessarily if it is being stored in browsers memory anyway... im just trying not to store it twice as it's just bad code!! any ideas if i need to write another line or not? (which would be)...

response.cookies.add(新的HttpCookie(cookieName,cookieValue)在客户端浏览器内存会话cookie

response.cookies.add(New HttpCookie("cookieName", "cookieValue") ' session cookie in client browser memory

谢谢你们

推荐答案

本的 MSDN 文章似乎表明有与用户禁用Cookie补偿没有内置的机制。这也表明,会话状态并不没有被启用Cookie,至少一定程度的工作。

This MSDN article seems to indicate that there is no built in mechanism for compensating with the user disabling cookies. It also indicates that session state does not work without at least some level of cookies being enabled.

我认为有一个机制来传递一个查​​询变量的会话ID,但略读文章(快)我没有看到这一点。

I thought that there was a mechanism for passing a query variable for the session id but skimming the article (quickly) I did not see this.

希望有所帮助。

编辑:它说,你可以使用Cookie会话(我想你可以)。他们使用一个单独的机制,以嵌入的会话ID的页面和URL链接。

It does say that you can use cookieless sessions (I thought you could). They use a separate mechanism to embed session ID in the pages and url links.

这篇关于如果禁用cookie,并asp.net存储的cookie作为会话cookie而不是或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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