如何通过IIS在Visual Studio中进行调试时删除URL段

时间:2016-09-05 11:04:11

标签: .net asp.net-mvc visual-studio iis visual-studio-2012

根据文件“How to: Specify a Port for the ASP.NET Development Server”。例如,如果您正在测试名为MyPage.aspx的页面,则在Visual Studio开发服务器上运行该页面时,该页面的URL可能如下所示:

http://localhost:31544/MyPage.aspx

由于IIS Express是Visual Studio 2012中Web应用程序项目的默认Web服务器。我更改了项目的属性,如下所述:

enter image description here

以前,我能够使用该方法调试我的.Net MVC项目,没有任何问题。

但是最近,每当我调试项目时,第二个URL的段都是随机生成的,如下所示:

http://localhost:5086/(S(ffi1hjahbgr1qcwzhziq2wo3))/MyPage.aspx

http://localhost:5086/(S(m3nq32tgyznmc04s5htp1exo))/MyPage.aspx

我该怎么做才能删除第二段?

1 个答案:

答案 0 :(得分:1)

好像你配置了ASP.NET Cookieless sessions for your ASP.NET application。这将生成您正在看到的Url类型。

ASP.NET MVC不支持此功能,因此您需要将其关闭。

在您的web.config中查找<authentication><forms>元素和set the cookieless option to useCookie。 ASP.NET MVC不支持其他值,并且存在与Cookieless会话功能相关的已知安全漏洞,因为可以使用Javascript和中间人设置轻松拦截te URI令牌,允许其他人轻松地hijaak会话

另见: