Ton*_*ich 10 asp.net iis visual-studio-2010
我在Windows 7 64位开发框中使用Visual Studio 2010 SP1.我的asp.net在框上使用IIS时运行正常,但当我切换到使用Visual Studio开发服务器时,我在此行中获得异常"System.Web.HttpException:无法验证数据"(在global.asax中的Application_AuthenticateRequest事件中)的.cs):
FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
Run Code Online (Sandbox Code Playgroud)
使用内部Web服务器时为什么会失败?
Mic*_*out 19
切换服务器后尝试删除cookie.两台服务器都有自己的配置,可能还有自己的解密密钥,表单身份验证cookie用于加密和解密.因此,如果您仍然使用IIS加密cookie,则切换项目以使用内置开发服务器并点击该站点,该服务器无法解密cookie.
如果将解密密钥放在web.config中,则可以防止此问题:
<machineKey decryptionKey="..." />
Run Code Online (Sandbox Code Playgroud)