Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to upload an website to an online server programmaticly via C# and using FTP.





When I do this, the wesbite says "You do not have permission to view this directory or page."

And if I just replaced the webconfig via FileZilla manually , the site starts working.

I'm using the edtftp library for .NET

Any ideas of whats going on ?

share|improve this question

I'm sure you double checked the credentials already. What it could be is the root path. Depending on how FTP is setup, the root path may be something like /username. FileZilla may have left that alone while edtftp didn't. When you log in with FileZilla, take note of the root path, then specifically set that in edtftp.

share|improve this answer
I fortgot to add, the files do upload succesfully. Then I get the permission error, afterwards I replace only the webconfig file manualy and then it magicly starts working. – Blottt Feb 9 '11 at 15:14
I wonder if it's a caching race condition where the site caches a failure while the site is uploading and then needs an AppDomain recycle (which is what 'touching' web.config causes) to work again. Try the page locally to see if you can get a substatus code. Is that from a default doc missing, or is it an actual permission issue? The IIS logs will show a sub-status code if you can't tell for sure from the error page. That may help narrow it down further. As a last resort you could push web.config as a last step in your code to cause the AppDomain recycle again. – Scott Forsyth - MVP Feb 9 '11 at 15:21
I think it does has something to do with the AppDomain recycle. And probably a substatus code of default doc missing. I solved it by doing an System.Threading.Thread.Sleep(5000) ( Needs to be 5 sec otherwise it won't work) And reuploading the Web.config from the application. – Blottt Feb 10 '11 at 9:58
Glad you got a working solution. Must have been some caching during the deployment. You may want to consider extra padding so that during times of server load it will still work correctly. – Scott Forsyth - MVP Feb 10 '11 at 16:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.