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

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

The functionality does not work ("Access to Path XYZ is denied") when:

  • I am running a website via IE by clicking on local webserver

The functionality works great when [note Visual Studio is running with administrator rights]:

  • I got into the game in Visual Studio
  • I'm talking about viewing in a browser from Visual Studio
  • I am running a website via IE by clicking on the local webserver but running IE with administrator rights
  • I am deploying a website to another web server (also vista / IIS7)
  • I change FireFox to accept Integrated Authentication then access via FireFox and localhost

I've never seen this before, before commands like File.Copy only cared that the rights to the copied folder were valid, etc. (I have everyone in full control when trying to debug this situation). Does it seem likely that the problem is with admin rights or not? Or log into the system it is running on?

What's going on here? Why does it work in a development environment and deploy to another machine, but not when deployed to my own machine? Seems very strange, any help would be appreciated.

EDIT : I added "Everyone" to all relvant directories and gave the user full control, so there shouldn't be any permission issues?

0


source to share


4 answers


OK I tracked down a solution to this problem with these symptoms in mind. I'm not 100% sure why this works (especially since it works great in FireFox and works great in IE if you don't connect locally), but the following seems to work.



In IE, select Tools -> Internet Options -> Security -> Trusted Sites -> Sites and add http: // localhost as a trusted site.Then you can use the site locally. Why it needs to be done in IE when connecting locally and not in FireFox or IE when connecting to another machine I don't know. But this seems to be a viable solution.

+2


source


Most likely, the user who has IIS running the leaked stream does not have access to the source file or destination. Have you tried making a copy directly as this user? When you run IE as administrator or run VS as administrator, the newly created user has full rights as admin.

[Edit - add link]



There is information about a similar stream, the idea of ​​using SysInternals is good:

UnauthorizedAccessException with IIS7

+2


source


You should try to give change permission via asp.net

you can find several articles about this with google (ing).

+2


source


My guess is that ASP.Net is running under no permission (NetworkService) or the user used for anonymous authentication has permission (IUSR)

0


source







All Articles