Override HttpContext.Current.User.Identity.Name
Asked Answered
M

1

0

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?
Mccrae answered 1/9, 2015 at 16:13 Comment(0)
K
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

Kep answered 1/9, 2015 at 21:52 Comment(1)
Seems like we need a whole new provider if we want to use a name property. We will work around it by introducing another variable. Thanks for the idea about the PostAuthenticate event. Note that it does not fire for Windows authentication.Mccrae

© 2022 - 2024 — McMap. All rights reserved.