Error Spawning Process from ASP.NET

  • Thread starter Thread starter hoochiegooch
  • Start date Start date
H

hoochiegooch

All,

I posted a message here recently regarding the difficulty
I'm having with CreateProcessWithLogonW() in an ASP.NET
application. I get the following Win32 error:

Error 183: Cannot create a file when that file already exists.

I thought it was Win2K3 or IIS6 giving me grief, but it
appears to behave the same way on a WinXP/IIS5 system.

I impersonated a domain admin and even wrote a small
test console app that is launched and logs the current
user info. This runs when spawned from another console
app (and has the correct new impersonation), but never
works from the ASP.NET app.

Is this kind of thing not permitted, no matter what
rights the user may have? I'm almost tempted to
create a simple .NET Remoting setup to do this
(and turn the 2nd app into a remoting server --
singleton -- which could work fine), but that seems
like a silly way to go.

Any ideas? I can provide more info if needed.

Thanks!
bn
 
Is the problem simply that the asp.net user only has read access to the Dir
when impersonated?

The asp.net account must have the rights to create the file, so it sounds
like your half way there as impersonation is usually the way to go.
However, you might want to use asp.net impersonation rather than
createprocesswithlogon and let the system worry about how the impersonation
works.

If you cant go this route, then ensaure everyone has file system access to
the dir you are creating in and tighten up from there once you have it
working.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
What exactly IS CreateProcessWithLogonW? It is not a method or property of
any classes in the CLR.

Pretend we don't know anything about your app. We don't.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
Kevin said:
What exactly IS CreateProcessWithLogonW? It is not a method or property of
any classes in the CLR.

Pretend we don't know anything about your app. We don't.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

It's a Win32 API function. It appeared to be
the best way to impersonate across process
boundaries.

bn
 
I would have to agree with John. Use the managed impersonation classes and
methods.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
Back
Top