473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Uploading a File on a shared documents folder programatically

All

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
Uri("https://DomainName.co.uk/Shared%20Documents/test/Test.txt");
NetworkCredential MSCred= new
NetworkCredential(MSUserID,MSPassword,MSDomain);
HttpWebRequest MSHttpWebRequest
=(HttpWebRequest)WebRequest.Create(MSURI);

CredentialCache MSCredentialCache = new CredentialCache();

MSCredentialCache.Add(MSURI, "Negotiate", MSCred);
MSHttpWebRequest.Credentials = MSCredentialCache;
MSHttpWebRequest.Method = "PUT";
MSHttpWebRequest.ContentType =
"text/plain";//"application/x-zip-compressed";
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
ostream.Read(obuffer,0,obuffer.Length);
Stream srWriter=null;
srWriter = MSHttpWebRequest.GetRequestStream();
srWriter.Write(obuffer,0,obuffer.Length);
srWriter.Close();
ostream.Close();
HttpWebResponse MSResponse =
(HttpWebResponse)MSHttpWebRequest.GetResponse();
MSResponse.Close();

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

Aug 31 '06 #1
0 1490

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: William GS | last post by:
Hello. How can I determine if a folder is shared? if it is shared, how can I retrieve the resource shared name? I have: Folder name ==> C:\WORKS\DOCS Resoure shared name ==> DOCUMENTS With...
0
by: wym | last post by:
I have written a web service that provides the following methods: UploadFile SetNTFSSecurity Their purpose is to allow a user to Upload a file to a shared folder with "Everyone" as permission...
7
by: chuckdfoster | last post by:
I am developing an ASP.NET site where an site administrator can upload files via ASP.NET into a Documents folder. These documents are then viewed by site users. I used the MS KB article...
2
by: Just Me | last post by:
If I use the shell32q.NameSpace(k) and the Parent property I can develop, for example, the path to My Music. Actually it ends with Desktop but Desktop can also be traced by using Parent to...
5
by: Phil Kelly | last post by:
Hi I need to write the contents of a structure to a binary file - there is one string and 2 integers, but I can't seem to figure out how to write the data correctly. If I am simply writing...
1
by: Paul | last post by:
My site does not have a domain name, just an IP address. I set a cookie in ASP.Net and I can read it with no problem on subsequent pages. My problem is that I want to actually see the file on...
2
by: Zoliq | last post by:
Hi, I have a serious problem. I'm currently developing an application in which the user should upload many files (600-700 xml files). I've searched the web for a while and so far I realized that...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
I need to programatically upload a text file to a web server using the HTTPWebRequest object within .Net 2.0. So far, I have determined that: - I need a HTTP content-type of...
5
by: =?Utf-8?B?QWRyaWFuTW9ycmlz?= | last post by:
Hello! I'm trying to copy a file from another computer on the network that I do not have permission with my current logon details to access. If I open the folder using the Windows file manager...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.