asp.net中的会话对象和coockies [英] Session object and coockies in asp.net

查看:168
本文介绍了asp.net中的会话对象和coockies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如果我是正确的,请查看并告诉我:


1)我的阅读理解
< a rel =nofollowhref =http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/\"target =_ blank> http:// msdn .microsoft.com / library / de ... us / dnpag / html /

diforwc-ch05.asp是asp.net使用cookie来存储用户会话ID,

但是如果没有启用cookie,那么它将发送会话ID作为网址的一部分。这是正确的吗?


2)我也从文章中了解到我使用的所有信息都是会话对象,例如Session [" UserName" ] = txtUserName.Text ...在服务器上保留

。如果web.config会话状态mode =" inproc"那么

会话对象信息将由Aspnet_wp.exe

进程存储和管理。因此,在这种情况下,无论用户是否启用cookie,Session [UserName]将始终具有有效的

数据。我是否正确?


这一切都让我得出结论,如果我使用Session对象存储

用户信息,那么我应该安全阅读并且存储信息

天气用户是否可以使用cookie。

谢谢

解决方案

问题是跟踪用户的会话。如果他们禁用了cookie,那么你不会知道哪个用户与服务器上的哪个会话相关(因此服务器不会知道哪个会话[" UserName]]到使用)。


注意:会话ID仅存储在URL中,如果您明确告诉它

在web.config中这样做


-ZD

" RA" < RO **** @ hotmail.com>在消息中写道

新闻:美国************** @ TK2MSFTNGP12.phx.gbl ...



如果我是正确的,请回顾并告诉我:

1)我从阅读中理解
http://msdn.microsoft.com/library/de...us/dnpag/html / diforwc-ch05.asp是asp.net使用cookie来存储用户会话
id,但如果没有启用cookie,那么它将发送会话ID作为网址的一部分。这是正确的吗?

2)我也从文章中了解到我使用会话对象的所有信息,如Session [" UserName"] = txtUserName.Text ...在服务器上保存
。如果web.config会话状态mode =" inproc"那么
会话对象信息将由Aspnet_wp.exe
进程存储和管理。因此,在这种情况下,无论用户是否启用cookie,Session [UserName]将始终具有有效的数据。我是否正确?

这一切都让我得出结论,如果我使用Session对象存储
用户信息,那么我应该安全阅读并存储
信息天气用户是否启用cookie。

谢谢



这不是微软文档中的说法。

查看文档,如果在浏览器中禁用了

cookie,您将看到它已应用于URL。


Z D < NO **** @ NOSPAM.com>在消息中写道

新闻:eS ************** @ TK2MSFTNGP09.phx.gbl ...

问题是跟踪用户的会话。如果他们禁用了
的cookie,那么你就不知道哪个用户与服务器上的哪个会话有关(因此服务器不知道要使用哪个Session [" UserName]]。
<注意:如果您在web.config中明确告诉它
这样做,会话ID只存储在URL中

-ZD

" RA" < RO **** @ hotmail.com>在消息中写道
新闻:美国************** @ TK2MSFTNGP12.phx.gbl ...



如果我是正确的,请复习并告诉我:

1)我的阅读理解


http://msdn.microsoft.com/library/de.com.cn / dnpag / html /

diforwc-ch05.asp是asp.net使用cookie来存储用户会话


id,

但如果未启用cookie,则会将会话ID作为url的
部分发送。这是正确的吗?

2)我也从文章中了解到我使用会话对象的所有信息
,例如Session [" UserName"] = txtUserName.Text ...是
保留在服务器上。如果web.config会话状态mode =" inproc"那么
会话对象信息将由Aspnet_wp.exe
进程存储和管理。因此,在这种情况下,无论用户是否启用cookie,Session [UserName]将始终具有
的有效数据。我是否正确?

这一切都让我得出结论,如果我使用Session对象来
存储用户信息,那么我应该安全地阅读和存储


信息

天气用户是否启用cookie。

谢谢




什么微软文件?


你必须在web.config中允许它,否则它不起作用。

" RA" < RO **** @ hotmail.com>在消息中写道

新闻:eX ************** @ tk2msftngp13.phx.gbl ...

这不是什么在微软文档中说。
查看文档,如果在浏览器中禁用了
cookie,您将看到它已应用于URL。

Z D < NO **** @ NOSPAM.com>在消息中写道
新闻:eS ************** @ TK2MSFTNGP09.phx.gbl ...

问题是跟踪用户的会话。如果他们禁用了cookie,那么

你就不知道哪个用户与服务器上的哪个会话有关(并且
因此

服务器不知道要使用哪个Session [" UserName]。

注意:如果您明确告诉


在web.config中这样做

-ZD

" RA" < RO **** @ hotmail.com>在消息中写道
新闻:美国************** @ TK2MSFTNGP12.phx.gbl ...



如果我是正确的,请查看并告诉我:

1)我对阅读的理解


http://msdn.microsoft.com/library/de ... us / dnpag / html /

diforwc-ch05.asp是asp.net使用cookie来存储用户


session

id,

但如果未启用cookie,则会将会话ID发送为



部分网址。这是正确的吗?

2)我也从文章中了解到,我使用会话对象的所有信息,如Session [" UserName"] = txtUserName.Text ...都保留在服务器。如果web.config会话状态mode =" inproc"那么
会话对象信息将由Aspnet_wp.exe
进程存储和管理。因此,在这种情况下,无论用户是否启用cookie,Session [UserName]将始终具有有效数据。我是否正确?

这一切都让我得出结论,如果我使用Session对象来存储用户信息,那么我应该安全地阅读和存储


信息< blockquote class =post_quotes>天气用户是否启用cookies。

谢谢





Hi

Please review and let me know if I am correct:

1) My understanding from reading
http://msdn.microsoft.com/library/de...us/dnpag/html/
diforwc-ch05.asp is that asp.net uses cookies to store the user session id,
but if cookies are not enabled then it will send the session id as part of
the url. Is this correct?

2) I also understand from the article that all the information I use with
the session object such as Session["UserName"]=txtUserName.Text... is kept
on the server. If the web.config session state mode="inproc" then the
session object information will be stored and managed by Aspnet_wp.exe
process. So in this case the Session["UserName"] will always have a valid
data regardless if the user enables cookies or not. Am I correct?

This all lead me to a conclusion that if I use the Session object to store
user information, then I should be safe reading and storing the information
weather the user enables cookies or not.
Thanks

解决方案

The issue is tracking the user''s session. If they have cookies disabled then
you wont know which user relates to which session on the server (and thus
the server wont know which Session["UserName"] to use).

Note: The session ID is only stored in the URL if you explicitly tell it to
do so in web.config

-ZD
"RA" <ro****@hotmail.com> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...

Hi

Please review and let me know if I am correct:

1) My understanding from reading
http://msdn.microsoft.com/library/de...us/dnpag/html/ diforwc-ch05.asp is that asp.net uses cookies to store the user session id, but if cookies are not enabled then it will send the session id as part of
the url. Is this correct?

2) I also understand from the article that all the information I use with
the session object such as Session["UserName"]=txtUserName.Text... is kept
on the server. If the web.config session state mode="inproc" then the
session object information will be stored and managed by Aspnet_wp.exe
process. So in this case the Session["UserName"] will always have a valid
data regardless if the user enables cookies or not. Am I correct?

This all lead me to a conclusion that if I use the Session object to store
user information, then I should be safe reading and storing the information weather the user enables cookies or not.
Thanks



This is not what being said in the microsoft document.
Look in the document and you will see that it is applied to the url if the
cookies disabled at the browser.

"Z D" <NO****@NOSPAM.com> wrote in message
news:eS**************@TK2MSFTNGP09.phx.gbl...

The issue is tracking the user''s session. If they have cookies disabled then you wont know which user relates to which session on the server (and thus
the server wont know which Session["UserName"] to use).

Note: The session ID is only stored in the URL if you explicitly tell it to do so in web.config

-ZD
"RA" <ro****@hotmail.com> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...

Hi

Please review and let me know if I am correct:

1) My understanding from reading


http://msdn.microsoft.com/library/de...us/dnpag/html/

diforwc-ch05.asp is that asp.net uses cookies to store the user session


id,

but if cookies are not enabled then it will send the session id as part of the url. Is this correct?

2) I also understand from the article that all the information I use with the session object such as Session["UserName"]=txtUserName.Text... is kept on the server. If the web.config session state mode="inproc" then the
session object information will be stored and managed by Aspnet_wp.exe
process. So in this case the Session["UserName"] will always have a valid data regardless if the user enables cookies or not. Am I correct?

This all lead me to a conclusion that if I use the Session object to store user information, then I should be safe reading and storing the


information

weather the user enables cookies or not.
Thanks




What microsoft document?

You have to allow it in web.config or else it doesnt work.
"RA" <ro****@hotmail.com> wrote in message
news:eX**************@tk2msftngp13.phx.gbl...

This is not what being said in the microsoft document.
Look in the document and you will see that it is applied to the url if the
cookies disabled at the browser.

"Z D" <NO****@NOSPAM.com> wrote in message
news:eS**************@TK2MSFTNGP09.phx.gbl...

The issue is tracking the user''s session. If they have cookies disabled then

you wont know which user relates to which session on the server (and thus

the server wont know which Session["UserName"] to use).

Note: The session ID is only stored in the URL if you explicitly tell it


to

do so in web.config

-ZD
"RA" <ro****@hotmail.com> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...

Hi

Please review and let me know if I am correct:

1) My understanding from reading


http://msdn.microsoft.com/library/de...us/dnpag/html/

diforwc-ch05.asp is that asp.net uses cookies to store the user

session

id,

but if cookies are not enabled then it will send the session id as


part of the url. Is this correct?

2) I also understand from the article that all the information I use with the session object such as Session["UserName"]=txtUserName.Text... is kept on the server. If the web.config session state mode="inproc" then the
session object information will be stored and managed by Aspnet_wp.exe
process. So in this case the Session["UserName"] will always have a valid data regardless if the user enables cookies or not. Am I correct?

This all lead me to a conclusion that if I use the Session object to store user information, then I should be safe reading and storing the


information

weather the user enables cookies or not.
Thanks





这篇关于asp.net中的会话对象和coockies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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