问题描述
我试图钩到Web窗体ASP.NET管道,并以这样的方式延长 HttpContext.Current.User.Identity
的名称
属性返回一个定制的实现。
一个可行的办法,我已经找到in另一个答案的,它有可能通过添加的权利要求来添加新的属性。这两个问题我有是:
- 在何处添加在ASP.NET Web窗体管道索赔?和
- 是否有可能取代现有的
名称
属性?
您可以在您的应用程序的Global.asax文件中PostAuthenticate事件。在FormsAuthenticationModule验证了窗体身份验证cookie后发生的事件PostAuthenticate
下面的链接可能会有所帮助:的
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:
- Where to add the claims in the ASP.NET Web Forms pipeline? And
- Is it possible to override the existing
Name
property?
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
这篇关于覆盖HttpContext.Current.User.Identity.Name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!