Override HttpContext.Current.User.Identity.Name

三世轮回 提交于 2019-12-25 12:00:24

问题


I am trying to hook into the Web Forms ASP.NET pipeline and extend the HttpContext.Current.User.Identity in such a way that the Name property returns a custom implementation.

One possible approach which I have found in another answer that it is possible to add new properties by adding claims. The two questions I have are:

  1. Where to add the claims in the ASP.NET Web Forms pipeline? And
  2. Is it possible to override the existing Name property?

回答1:


You can implement the PostAuthenticate event in your application's Global.asax file. The PostAuthenticate event occurs after the FormsAuthenticationModule has verified the forms authentication cookie.

the following link might be helpful: http://bytes.com/topic/asp-net/answers/860607-setting-httpcontext-current-user



来源:https://stackoverflow.com/questions/32336360/override-httpcontext-current-user-identity-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!