不会保存会话对象 [英] Won't save session object

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

问题描述

我有一个使用会话对象的asp.net应用程序(ag。会话(UserID))。

该应用程序在开发/调试模式下工作正常。我将它发布到测试

服务器(运行其他.NET应用程序的Windows 2000服务器)和

,当我坐在运行应用程序的服务器上时,它也是运行正常。

但是,如果我坐在局域网上的任何工作站上它都不起作用。我把问题缩小到了这个问题,因为当它们应该包含数据时,所有会话对象都不包含任何内容。是否需要在应用程序或服务器上完成某些事情才能解决这个问题?如何在应用程序上线时获取

会话对象来保存数据?


Scott

I have an asp.net app that uses session objects (ag. session("UserID")).
The app works fine in development/debug mode. I released it to the test
server (Windows 2000 server with other .NET applications running on it) and
when I am sitting at that server running the application, it also runs fine.
But, if I sit at any workstation on the LAN it does not work. I narrowed
the problem down to the fact that all of the session objects contain nothing
when they should contain data. Is there something that needs to be done in
the application or on the server that can fix this? How can I get the
session objects to hold the data when the application goes live?

Scott

推荐答案

在不能正常工作的机器上启用了cookie吗?会话

cookie必须允许会话状态才能工作。


" Schoo" < SC *********** @ nospam.ma-hc.com>在消息中写道

新闻:OL ************** @ TK2MSFTNGP09.phx.gbl ...
Are cookies enabled on the machines that don''t work properly? Session
cookies must be allowed for session state to work.

"Schoo" <sc***********@nospam.ma-hc.com> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
我有一个asp。使用会话对象的网络应用程序(ag。会话(UserID))。
该应用程序在开发/调试模式下工作正常。我将它发布到测试服务器(Windows 2000服务器上运行其他.NET应用程序)
,当我坐在运行该应用程序的服务器上时,它也运行
罚款。但是,如果我坐在局域网上的任何工作站上它都不起作用。我将问题缩小到这样一个事实,即当它们应该包含数据时,所有会话对象都包含
。是否需要在应用程序或服务器上执行
的操作才能解决此问题?如何在应用程序上线时获取
会话对象来保存数据?

Scott
I have an asp.net app that uses session objects (ag. session("UserID")).
The app works fine in development/debug mode. I released it to the test
server (Windows 2000 server with other .NET applications running on it) and when I am sitting at that server running the application, it also runs fine. But, if I sit at any workstation on the LAN it does not work. I narrowed
the problem down to the fact that all of the session objects contain nothing when they should contain data. Is there something that needs to be done in the application or on the server that can fix this? How can I get the
session objects to hold the data when the application goes live?

Scott





或者您可以更改web.config文件并更改''sessionState''部分以启用''cookieless''会话处理。这会破坏每个请求的URL以包含唯一的会话ID,这很丑陋......但它确实有效。

----- Marina写道:-----


是否在无法正常工作的机器上启用了cookie?会话

cookie必须允许会话状态才能工作。


" Schoo" < SC *********** @ nospam.ma-hc.com>在消息中写道

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

Or you can change the web.config file and alter the ''sessionState'' section to enable ''cookieless'' session handling. This mangles the URL of each request to include the unique session id, which is ugly... but it works.
----- Marina wrote: -----

Are cookies enabled on the machines that don''t work properly? Session
cookies must be allowed for session state to work.

"Schoo" <sc***********@nospam.ma-hc.com> wrote in message
news:OL**************@TK2MSFTNGP09.phx.gbl...
我有一个asp。使用会话对象的网络应用程序(ag。会话(UserID))。
该应用程序在开发/调试模式下工作正常。我将它发布到测试服务器(Windows 2000服务器上运行其他.NET应用程序)
,当我坐在运行该应用程序的服务器上时,它也运行
罚款。但是,如果我坐在局域网上的任何工作站上它都不起作用。我将问题缩小到这样一个事实,即当它们应该包含数据时,所有会话对象都包含
。是否需要在应用程序或服务器上执行
的操作才能解决此问题?当应用程序上线时,如何让
会话对象保存数据?
I have an asp.net app that uses session objects (ag. session("UserID")).
The app works fine in development/debug mode. I released it to the test
server (Windows 2000 server with other .NET applications running on it) and when I am sitting at that server running the application, it also runs fine. But, if I sit at any workstation on the LAN it does not work. I narrowed
the problem down to the fact that all of the session objects contain nothing when they should contain data. Is there something that needs to be done in the application or on the server that can fix this? How can I get the
session objects to hold the data when the application goes live?
Scott



您好Scott,

感谢您在社区中发帖!

从您的描述中,您发现您的网络应用程序的会话状态不是

当你的某个工作站客户端访问你的

那边时工作,是吗?

如果有任何我误解的地方,请随时告诉我。


至于你提到的问题,我认为Marina的建议非常有用,因为他提到这个问题很可能是由于那些问题所致。 $>
客户端机器的cookie设置。


实际上,ASP.NET的会话默认与所有客户端关联

机器通过cookie变量命名为ASP.NET_SessionId它标识特定用户的唯一会话ID

。如果客户机在其浏览器中禁用了cookie,那将导致客户端无法在服务器端关联其

会话状态,那么我们将找到会议不起作用。那么

你能不能试试检查客户的浏览器,看看

cookie是否被禁用了?

你可以办理登机手续浏览器的设置。在IE中,您可以在

工具 - > interntet选项 - >隐私设置面板中找到设置,看看是否已经阻止了某些网站的cookie


另外,检测cookie的另一种方法是在某个

ASP.NET页面中编写一些代码来编写某个cookie变量然后检索它,

例如:

if(!IsPostBack)

{

响应。 Cookies.Add(新HttpCookie(...));

}

其他

{

//通过Request.Cookies [...]获取特定的cookie。值;

}


如果无法再次从客户端检索cookie,必须有

客户端的cookie设置不正确。


另外,这里有一些关于ASP.NET会话和cookie的技术人员

实现:


#ASP.NET中会话状态实现的底层
http://msdn.microsoft.com/library/en...ionstate.asp?f

rame = true


asp.net中的cookies的基本知识
http://msdn.microsoft.com/library/de...us/dv_vstechar

t / html / vbtchaspnetcookies101.asp

http://msdn.microsoft.com/msdntv/epi...20030318ASPNET

RH / manifest.xml
http://www.eggheadcafe.com/PrintSear...asp?LINKID=401

希望他们有所帮助。

问候,


Steven Cheng

Microsoft O nline支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)


在ASP.NET上获取预览whidbey
< a rel =nofollowhref =http://msdn.microsoft.com/asp.net/whidbey/default.aspxtarget =_ blank> http://msdn.microsoft.com/asp.net/whidbey /default.aspx

Hi Scott,
Thanks for posting in the community!
From your description, you found your web application''s sessionstate not
work when it is visited by some certain workstation client side on your
side,yes?
If there is anything I misunderstood, please feel free to let me know.

As for the problem you mentioned, I think Marina''s suggesion is quite
informative, as he mentioned that this problem is likely due to those
client machine''s cookie setting.

In fact, the ASP.NET''s session is by default associated with all the client
machine via cookie variable named "ASP.NET_SessionId" which identitfy the
unique session id of the certain user. If the client machien has disabled
the cookie in its browser, that''ll cause the client unable to associate its
sessionstate on the serverside, then we''ll found the session not work. So
would you please try checking the client''s browser to see whether the
cookie has been disabled?
You can check in the Browser''s setting. In IE, you can find the setting in
the tools-->interntet options-->privacy setting panel and see whether
you''ve block the certain site''s cookie

Also, another means to detect the cookie is to write some code in a certain
ASP.NET page to write a certain cookie variable and then retrieve back it ,
for example:
if(!IsPostBack)
{
Response.Cookies.Add(new HttpCookie(...));
}
else
{
//get the certain cookie via Request.Cookies[...].Value;
}

If unable to retrieve the cookie from clientside again, there must be
something incorrect with the client''s cookie setting.

In addtion, here are some tech artielcs on ASP.NET session and cookie
implementation:

#Underpinnings of the Session State Implementation in ASP.NET
http://msdn.microsoft.com/library/en...ionstate.asp?f
rame=true

#basics of cookies in asp.net
http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vbtchaspnetcookies101.asp

#Enabling Cookieless Session State in ASP.NET
http://msdn.microsoft.com/msdntv/epi...20030318ASPNET
RH/manifest.xml

http://www.eggheadcafe.com/PrintSear...asp?LINKID=401

Hope they''re helpful.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx


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

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