By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,707 Members | 839 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,707 IT Pros & Developers. It's quick & easy.

Uploading a File on a shared documents folder programatically

P: n/a

I'm having trouble getting the following to work. I have been able to
download and delete a file with the same credentials and similar code,
but when I try upload the file. I get a returned error of "The Remote
server returned an error: (500) Internal Server Error." from the SPS.

Is there something that must be set up on SPS to allow a "PUT" or am I
missing something.
I am using very similar code to delete and download a file from the
same folder on the SPS. And its all working perfectly

Uri MSURI = new
NetworkCredential MSCred= new
HttpWebRequest MSHttpWebRequest

CredentialCache MSCredentialCache = new CredentialCache();

MSCredentialCache.Add(MSURI, "Negotiate", MSCred);
MSHttpWebRequest.Credentials = MSCredentialCache;
MSHttpWebRequest.Method = "PUT";
MSHttpWebRequest.ContentType =
MSHttpWebRequest.Headers.Add("Translate", "f");
MSHttpWebRequest.Timeout = 30000;
MSHttpWebRequest.KeepAlive = false;

FileStream ostream;
byte[] obuffer;
ostream = File.OpenRead(AppConfig.XMLFeedFilePath + ZIPFile.Name);
obuffer = new byte[ostream.Length]; // byte buffer
Stream srWriter=null;
srWriter = MSHttpWebRequest.GetRequestStream();
HttpWebResponse MSResponse =

Has anyone else experienced similar behaviour and if so how were you
able to solve it.

Aug 31 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.