Asp.net impersonates a user to access network resources

the code:

System.Security.Principal.WindowsImpersonationContext impersonationContext;
impersonationContext =
    ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();

//access network resources.

impersonationContext.Undo();

web.config:

<authentication mode="Windows">       
</authentication>
<identity impersonate="true"
userName="user"
password="password"></identity>

As can be seen from the web.config file, the application runs in issuing mode. I need to temporarily pretend to be in order to gain access to a network resource. I am doing this as shown above.

This works fine on the server if I browse the site on a local IE installed on the server, but when I access the application from my PC or any other PC, I get denied access.

Btw, it's all in a corporate domain environment. therefore IE in both cases passes a valid authenticated token.

Any ideas on what is going on. thank.

+3
source share
1 answer

, ( ).

, , , , , , .

, , "Kerberos Double Hop". " " - , . IE, Active Directory ( xyz) - .

. Kerberos Double Hop

. DelegConfig - .

.: TechNet

:

+3

Source: https://habr.com/ru/post/1741292/


All Articles