I have my own Windows Server 2008 box that contains many web sites that all contain the same code base. I've written some code in an MVC 3 Administrator application which works locally that can deploy the common codebase from a single folder, to all the designated web site folders with a simple button click.

The problem occurs when this application is uploaded to the server. The code to copy the codebase to the various websites returns the error, "Access Denied...". I know why this is happening but I don't know how to overcome it programmatically.

Each web site that is created on the server is created by the WebSitePanel hosting control panel. So it logically creates and sets a Windows user for these sites. That's understandable.

When I manually log onto the server and assign a website to include the same user as my Admin web site, the code works! Which is also understandable.

So this is what I'm trying to achieve programmatically. I know that there's just something I must do to assign the Admin user to the child web site in order to have permission to copy the files.

I've "borrowed" code from WebSitePanel source code that allows that application to create folders on the server for web sites and assign permissions to them, and it doesn't seem to work for me.

If anyone has any ideas how to achieve this using C# code, it would be appreciated.

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.