Cookie会话从URL查询字符串来 [英] Cookieless session from URL to QueryString

查看:171
本文介绍了Cookie会话从URL查询字符串来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在与有ASP.NET中的Cookie会话的一个问题,根据MSDN上的>当您使用自动检测:


  

ASP.NET决定请求的浏览器或设备是否支持Cookie。如果请求的浏览器或设备支持Cookie,自动检测使用cookies坚持用户数据; ,否则,一个标识符在查询字符串使用。如果浏览器或设备支持Cookie,但目前禁用cookie,饼干仍在使用的请求的功能。


请注意查询字符串的一部分!现在,如果它确实添加到URL如&放大器;的sessionId = yoursessionidhere 这一切都很好,但实际上我所得到的都是这样的URL: HTTP:/ / yourserver /文件夹/(会话ID这里)/default.aspx

所以我的问题是:我将如何配置ASP.NET使用的查询字符串(因为它声称)而不​​是此URL污损方法

更新:

我加入我们在web.config中使用配置值:

 <的sessionState模式=的StateServerstateConnectionString这一=TCPIP = 127.0.0.1:42424无Cookie =自动检测超时=20/>


解决方案

在这里读了这资源 http://forums.asp.net/t/1480365.aspx/1 你有无cookie =UseUri在web.config文件中设置 - 尝试删除,从我收集它可以帮助!不要让我知道!

此外它很可能是值得发布您的配置块中的问题。

香港专业教育学院做多一些挖掘,发现这个职位,涵盖请求源$ C ​​$ C为MVC处理 - 使用会话ID的路由看起来pretty深烘焙的URL - 看到除外答案code块可能的错误在ASP.NET MVC 3路由?

我会一直在找你,但是这其中有我难住了!我想你需要得到一个像Hanselmann,哈克或飞碟双向面前这个问题。

We're currently having an issue with cookieless sessions in ASP.NET, according to the documentation on MSDN here when you use AutoDetect:

ASP.NET determines whether the requesting browser or device supports cookies. If the requesting browser or device supports cookies, AutoDetect uses cookies to persist user data; otherwise, an identifier is used in the query string. If the browser or device supports cookies, but cookies are currently disabled, cookies are still used by the requesting feature.

Notice the query string part! Now if it were indeed added to the URL like &sessionId=yoursessionidhere it's all fine but actually what I get are URLs like this: http://yourserver/folder/(session ID here)/default.aspx.

So my question is: How would I configure ASP.NET to use the querystring (as it claims) instead of this URL defacing method?

UPDATE:

I'm adding the config value we use in our web.config:

<sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="AutoDetect" timeout="20" />

解决方案

Reading this resource here http://forums.asp.net/t/1480365.aspx/1 do you have the cookieless="UseUri" setting in the web.config - try deleting that from what I gather it may help! Do let me know!

Additionally it would probably be worth posting your config block in the question.

Ive done some more digging and found this post which covers the request handling in the source code for MVC - using the session id in the URL for routing looks to be baked in pretty deep - see the excepted answer code blocks Possible Bug With ASP.NET MVC 3 Routing?

I'll keep looking for you but this one has me stumped! I think you need to get this question in front of someone like Hanselmann, Haack or Skeet.

这篇关于Cookie会话从URL查询字符串来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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