0

While in my server I have assigned full control permissions for the folder where the files needs to be uploaded.

The website's application pool identity is being set with a domain user credentials, the website has anonymous authentication enabled set with application pool identity.

Have tried with webclient's uploaddata and uploadfile, setting credentials with the same domain user credentials after taking input from webpage's htmlinputfile.

using (WebClient wcUpload = new WebClient())
{
   wcUpload.Credentials = new System.Net.NetworkCredential(strCurrentUser, strPassword);
   //wcUpload.UploadFile(@strDataFeedSchemaFile, XsdFileUpLoaded.PostedFile.FileName);
   wcUpload.UploadData(@strDataFeedSchemaFile, buffer);
   //strDataFeedSchemaFile is the file which needs to be replaced
   //buffer is the byte[] from the htmlinputfile
}


Objective is to upload an XSD file from htmlinputfile control, and save/replace in an existing folder/directory in webserver.

What else I am missing out resulting me to UnauthorizedAccessException and Access to path is denied :(

Vinay
  • 471
  • 3
  • 8
  • 19

1 Answers1

0

Silly mistake :( Had file attributes read only true :(

If would have checked the file property of the server earlier, could have saved a lots of time.

If anybody faces similar scenario, please check for the file property first.

Vinay
  • 471
  • 3
  • 8
  • 19