Click to See Complete Forum and Search --> : [RESOLVED] Process.Start


jasonli
September 18th, 2008, 09:33 AM
here is the situation:

I have one program running on intranet folder which I don't have write permission on. But when the program runs, some temp files need to be saved in current directory. So I got error "Access is denied on ...".

So I have to create the other program to run the part that produces temp files and then put it on local machine. I use Process.Start to call this program by the program on intranet folder. BUT temp files still go to intranet folder.

I thought the program on local machine would run individually, actually NO!

Anybody has idea to solve this problem? Thanks.

MikeVallotton
September 18th, 2008, 09:51 AM
That would be a fairly large security hole if you could do that, don't you think?

What version of .NET are you using, and what do you need to write temp files for? If they're truly temp files for use within your application, you could make a call to GetTempDirectory(), which will give you a directory that you do have permissions to write to.

Alternatively, you could increase the permissions of your application using caspol, or the .NET framework configuration tool, or by making a custom installer that provides your assembly with the needed permissions.

jasonli
September 18th, 2008, 10:11 AM
Thanks for your reply.

I added one line to solve the problem.pro.StartInfo.WorkingDirectory = Path.GetDirectoryName(exefilepath);

Absolutely no write permission for users on that folder where main application locates. Now it's running very well.