简体   繁体   中英

c# impersonation problem

I have a method that runs executes a batch file. This worked until I implemented the IIS7 integrated pipeline authentication, restricting access to any static files hosted in my app.

I have since found out that adding this change, that the process tries to execute through the NETWORK SERVICE account instead of my impersonation token in my web.config.

Is there any reason for this or a way for me to force the method to use the impersonated user?

EDIT

Of course now Ive implemenet the integrated pipeline, the application sees the batch file as a static file and was trying to access it via the annoymous user account, which was set to application pool identity, which in turn is using NETWORK SERVICE account.

the files were situated in a separate class library directory on the hard drive and not hosted through the application. I have tried to rectify this by adding them to a folder in my application, hoping that now integrated pipeline would see that the user is authenticated and allow access. This is not the case, the batch files are still executed using the annoymous authentication account. :(

Thanks!

If anyone gets here then I would suggest heading to this site

http://blogs.msdn.com/b/alejacma/archive/2007/12/20/how-to-call-createprocesswithlogonw-createprocessasuser-in-net.aspx

I found that the createprocessasuser method works a treat. But now Im struggling with pipes to get the standard output from said method. Im using this post to help with this,

How to get standard output from CreateProcessWithLogonW?

hope this helps!

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