Asp – How to copy files with ASP.Net using Vista and IIS7

asp.netiis-7windows-vista

I have a button on a website that creates a directory and copys a file. I developed it using Visual Studio 2008, ASP.Net 3.5. I am running Vista as my OS. The website uses identiy impersonation.

The functionality doesn't work ("Access to Path XYZ is denied") when:

  • I run the website via IE hitting the local webserver

The functionality works fine when [note Visual Studio run with Admin rights]:

  • I hit play in Visual Studio
  • I say view in Browser from Visual Studio
  • I run the website via IE hitting the local webserver, but start IE with Admin rights
  • I deploy the website onto another webserver (also vista/IIS7)
  • I modify FireFox to accept integrated authentication, then access via FireFox and localhost

I've never seen this behavior before, previously File.Copy type commands only cared that the rights on the folder being copied to were valid etc… (I have Everyone having full control while trying to debug this situation). It seems likely that the issue is having Admin rights or not? Or being logged in to the machine that it is running on?

What is happening here? Why does it work in the development environment and deployed to another machine, but not work when deployed on my own machine? Seems very odd, any help would be appreciated.

EDIT: I've added "Everyone" to all of the relvant directories and give that user Full Control, so there shouldn't be any permission issues?

Best Answer

You should try giving permission to modify over asp.net

you can find several articles about that by google(ing) it.