[英]How to get IIS Express to work with Forms Authentication
So I've just started working on a new ASP.NET project using VS 2012 and .NET 4.5. 因此,我刚刚开始使用VS 2012和.NET 4.5进行新的ASP.NET项目。 The default dev server is IIS Express.
默认的开发服务器是IIS Express。 I'm using Forms Authentication, which works on my previous project running on .NET 4.0, developed on VS 2010, and debugged on Cassini.
我使用的是Forms Authentication,它可用于我先前在.NET 4.0上运行,在VS 2010上开发并在Cassini上调试过的项目中。 I cannot, for the life of me, figure out why Forms Authentication just won't work on IIS Express.
我一辈子都无法弄清楚为什么表单身份验证在IIS Express上不起作用。
The conditions are: 条件是:
Every time I log in and try to access a protected page, I get bounced back to my login page. 每次登录并尝试访问受保护的页面时,我都会跳回到登录页面。 So I set a breakpoint at
Page_Load
in my login page and see that after every login, Request.IsAuthenticated
still evaluates to FALSE. 因此,我在登录页面的
Page_Load
处设置了一个断点,并看到每次登录后, Request.IsAuthenticated
仍然评估为FALSE。
What gives? 是什么赋予了?
Found it! 找到了!
It turns out that I had FormsAuthentication.Encrypt()
return null. 原来我有
FormsAuthentication.Encrypt()
返回null。 All of this caused by me manually building the ticket and setting the UserData
field to null. 所有这些都是由我手动生成票证并将
UserData
字段设置为null引起的。 UserData
cannot be null. UserData
不能为null。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.