【发布时间】:2020-07-06 20:12:05
【问题描述】:
我将在我的 mvc.net Web 应用程序中使用一个类库作为数据层。是否可以从类库中访问 User.Identity.GetUserId()。
我可以使用 HttpContext.Current.User.Name 而不是 UserId 来访问用户名。
同时,在类库项目中无法访问 Microsoft.Aspnet.Identity 引用。
谢谢
【问题讨论】:
-
如果你打算使用 GetUserId() 扩展方法。您必须添加 Microsoft.Aspnet.Identity 参考。
标签: asp.net-identity console-application class-library