如何防止无 cookie 的 URL?
据我所知,我已经在 web.config 中的所有位置禁用了 cookieless URL:
<system.web>
<sessionState cookieless="UseCookies" />
<authentication mode="Forms">
<forms cookieless="UseCookies" loginUrl="~/loggain" timeout="2880" />
</authentication>
<anonymousIdentification enabled="false" cookieless="UseCookies" />
<system.web>
在浏览我们的网站时,我仍然时不时地收到 cookieless URL。 该路径可能如下所示: /(F(5wpzvCsOC[...snip...]9NXal01))/About/
问题是我们的一些 URL 包含可能很长的产品名称,这会导致 HttpException ,其中“URL 的长度 [. ..] 超过了 [...] maxUrlLength”。另外,Google 似乎对这些 URL 建立了索引,但我添加了规范链接来避免这种情况。
如果这很重要的话,它是一个在 IIS7.5 上运行的 ASP.NET MVC 3 站点。
编辑: 我已经把这个问题搁置了一段时间,但今天我突然意识到它可能与缓存有关。 我缓存了一些子操作以加快速度,但是如果缓存的请求包含 (F([stuff])),则缓存自然(?)包含这些链接。 现在的问题是我是否可以阻止 ASP.NET MVC Html.ActionLink() 首先生成这些链接?
As far as I know, I have disabled cookieless URLs in all places in web.config:
<system.web>
<sessionState cookieless="UseCookies" />
<authentication mode="Forms">
<forms cookieless="UseCookies" loginUrl="~/loggain" timeout="2880" />
</authentication>
<anonymousIdentification enabled="false" cookieless="UseCookies" />
<system.web>
I still get the cookieless URLs from time to time, browsing our site.
the path can look something like this:
/(F(5wpzvCsOC[...snip...]9NXal01))/About/
The problem is that some of our URLs include product names that can be very long which results in a HttpException with "the length of the URL [...] exceeds the [...] maxUrlLength". Also Google seems to index these URLs, but I've added link canonical to try to avoid this.
It's an ASP.NET MVC 3 site running on IIS7.5, if that matters.
EDIT:
I've had this problem put on the shelf for a while, but today it occurred to me that it could have something to do with caching.
I cache some child actions to speed things up a bit, but if the request that gets cached contains the (F([stuff])), the cache naturally(?) contains these links.
The question now is if I can prevent ASP.NET MVCs Html.ActionLink() from generating these links in the first place?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论