0

I have a Web Intranet Application, with windows authentication which creates a file and saves it to a folder locally. I want the user to be able to open that folder.

I am currently doing this,

System.Diagnostics.Process.Start("C:\ABC");

The above code was running fine while development on my local machine. But it doesn't work after i deployed it to server. I want user to open the C:\ABC folder which exists on server.

I gave Application Pool the rights and now both User and app pool, have full rights to the folder. And now i am getting the plain error

Access Denied.

But why ?

Nanu
  • 3,010
  • 10
  • 38
  • 52

3 Answers3

0

Edit

Check that post : System.Diagnostics.Process.Start not work from an IIS

Community
  • 1
  • 1
Arno 2501
  • 8,921
  • 8
  • 37
  • 55
  • 1
    Yes, this is likely a permissions issue. Is this a web application, or windows application? If it is a web application, the identity of the application pool will need permissions. If it is a windows application, the user identity running the application will. If you have the need to impersonate a user, here is some example code: http://stackoverflow.com/questions/233490/need-to-impersonate-user-foraccessing-network-resource-asp-net-account – JNadal Nov 09 '12 at 16:00
  • It's a web application, and Application pool and user both have rights to access the folder. I am not using impersonation. – Nanu Nov 09 '12 at 16:27
  • Did you try to set rights to everyone full rights just to check that it works ? – Arno 2501 Nov 09 '12 at 16:34
0

If your application is running within IIS, then the appropriate IIS identity will need permissions to at least read that folder. The actual identity you are using will depend on how you have configured your web application.

Polyfun
  • 9,479
  • 4
  • 31
  • 39
0

You might get Access Denied if something else has the file locked. You can use WhoLockMe for that specifically.

You can also troubleshoot file access problems with Process Explorer, and filter for that file. sometimes you will get more detailed information. Basically when your app tries to access the file, Process Explorer will show an error for the failed access which may or may not give you more details than the API's exception does. Sometimes an API might say Access Denied when in reality it cannot find the file, which Process Explorer will make more apparent.

http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

AaronLS
  • 37,329
  • 20
  • 143
  • 202