ASP.NET user permissions  
Author Message
tinny4u





PostPosted: ASMX Web Services and XML Serialization, ASP.NET user permissions Top

I am running an ASP.NET application on Server 2003. I want my application to start an external process.

 

E.g. System.Diagnostics.Process process = System.Diagnostics.Process.Start(processPath,arg );

 

When I try and do this using the above code it doesn’t work. I do not have any debugging facilities on the server so my only guess is that the ASP.NET user does not have adequate permissions to execute the process. Sound plausible

 

How do I give the ASP.NET user the rights to do this

 

Or, can i somehow launch this process using another user login

 

Thanks



.NET Development8  
 
 
ulven





PostPosted: ASMX Web Services and XML Serialization, ASP.NET user permissions Top

I'm facing the same problem and can't find a solution. Did you solve this problem

Thanks

Ulf


 
 
rfreire





PostPosted: ASMX Web Services and XML Serialization, ASP.NET user permissions Top

Try giving permissions to the folder in where the process resides and to the process executable file itself to the local account called ASPNET.


 
 
ulven





PostPosted: ASMX Web Services and XML Serialization, ASP.NET user permissions Top

I've tried that without any success. ASPNET has full control of the folder where the process executable file is located and to the process executable file itself. ASPNET also has full control of folder where the output of the executable should be written.

This is my code:

Process p = new Process();
p.StartInfo.FileName =
"C:\\WINDOWS\\MPSReports\\Network\\bin\\DumpEVT.exe";
p.StartInfo.Arguments =
"C:\\logs\\evtlog";
p.StartInfo.UseShellExecute =
false;
p.StartInfo.CreateNoWindow =
false;
p.Start();
p.WaitForExit();

Any other ideas

Thanks

Ulf


 
 
rfreire





PostPosted: ASMX Web Services and XML Serialization, ASP.NET user permissions Top

In that case... code access security may be restricting asp.net to perform this operation.

In that case.... you should put your code in a separate class library (assembly)... sign this assembly and put it in the GAC....

Code from the GAC has full rights so permissions won't be a problem... this approach is called "sandboxing".


 
 
ulven





PostPosted: ASMX Web Services and XML Serialization, ASP.NET user permissions Top

Thanks for your answer. I tried to put the code in a separate class library. Then I signed it and added it to the GAC. According to the output of gacutil /l the assembly is in the GAC.

However the code still doesn't work. I can run the application (DumpEVT.exe) from the command prompt and put the output files in my folder. When I try to run my code the output files are deleted from the folder but no new files are created.


 
 
rfreire





PostPosted: ASMX Web Services and XML Serialization, ASP.NET user permissions Top

Let me see if I'm getting you....

you were able to run the process.... but it is not running properly.... that's right ...

What about adding this:

p.StartInfo.Username = "some other user";

p.StartInfo.Password = "user password";

Rgds

Rodrigo


 
 
ulven





PostPosted: ASMX Web Services and XML Serialization, ASP.NET user permissions Top

I suppose the process started since some files were deleted in the folder but I don't know if that is the correct behaviour. It certainly wasn't producing any output so that wasn't right.

In the taskmanager I saw that ASPNET was running some processes which it shouldn't. Killing the processes didn't help so I did a reboot and tried the code again and now it works.

Thanks for your help, now I know what sandboxing is! :)