How can I execute an action from ASP.NET MVC with different user credentials?

I hope this explanation makes sense, but the best way (if possible) is to transfer user credentials to prepare a specific application from an ASP.NET MVC application. I am currently working on creating directories on another server, we cannot do this using the shared credentials that the application works with; however, we were told that we can, if we transfer the credentials of the user who is currently using the application.

We are currently working on IIS 6.0, but in the near future we will move on to IIS 7.0 and also use integrated Windows authentication for web applications.

+4
source share
2 answers

Here is an article in KB that describes several ways to impersonate a user.

Note that some of their examples seem to use the current authenticated user, but you can obviously adapt it to use any user you want.

Edit: I used a code very similar to the “Personalize a specific user in code” section to access files on a remote resource using user credentials with access to the specified resource. Pretty straight forward.

+1
source

Yes. You should take a look at the User property and IIS Authenticated methods.

0
source

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


All Articles