【发布时间】:2012-04-22 19:14:58
【问题描述】:
我正在使用 asp.net 配置文件系统。我在 mASP.NET MVC 中创建了一个名为 CustomProfile 的模型。在这个模型中,我创建了 3 个函数 CreateProfile()、SaveData()、LoadProfile()。
我从 AcountController 的登录操作中调用 LoadProfile(),但问题是当我在 LoadProfile() 函数中使用 HttpContext.Current.Profile 时,它显示用户名为空。有什么问题?
【问题讨论】:
-
是否在 IIS 中为您的网站启用匿名身份验证?
-
在调用 LoadProfile() 之前用户是否经过身份验证?查看这 3 个函数的代码会很有帮助。
标签: c# .net asp.net-mvc httpcontext asp.net-profiles