简体   繁体   中英

Set Windows username as header IIS 10

I am using IIS 10 with Windows authentication. I can see the windows username in the log files, and i am looking for a way to capture it (after authentication) and using rewrite to store it in a request header Is that possible without too much fuss?

You can do this with VB or C#, I will give an example of both

VB.NET:

If User.Identity.IsAuthenticated Then
    Label1.Text = User.Identity.Name

C#:

if (User.Identity.IsAuthenticated)
    Label1.Text = User.Identity.Name;

Hopefully this is what you needed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM