覆盖HttpContext.Current.User.Identity.Name

时间:2015-09-01 16:13:14

标签: asp.net webforms windows-authentication claims iidentity

我试图挂钩到Web窗体ASP.NET管道并以HttpContext.Current.User.Identity属性返回自定义实现的方式扩展Name

我发现in another answer的一种可行方法是可以通过添加声明来添加新属性。我有两个问题:

  1. 在ASP.NET Web窗体管道中添加声明的位置?
  2. 是否可以覆盖现有的Name属性?

1 个答案:

答案 0 :(得分: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