473,795 Members | 3,231 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTTPWebRequest - Programatically Uploading Text File with POST

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 "multipart/form-data".
- I need to use the ContentType.Bou ndary property.

That is about as far as I have gotten.

I have searched long and far for examples to do this in .Net but I can not
seem to find anything?

Does anyone have a code example or URL that I can look at to put the pieces
of the puzzle together?

TIA
Jun 27 '08 #1
3 4232
I forgot to add that this must all be done programatically .

No user interface, no client.

I retrieve the data that I want to upload programatically and I must somehow
create a HTTPWebRequest that will use a POST request and the
"multipart/form-data" content type.

"Paul" wrote:
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 "multipart/form-data".
- I need to use the ContentType.Bou ndary property.

That is about as far as I have gotten.

I have searched long and far for examples to do this in .Net but I can not
seem to find anything?

Does anyone have a code example or URL that I can look at to put the pieces
of the puzzle together?

TIA
Jun 27 '08 #2
This might not be correct, but check here:
http://groups.google.com/group/micro...13224a77b89add

I have "POST" code somewhere in that helper I think.

"Paul" <Pa**@discussio ns.microsoft.co mwrote in message
news:04******** *************** ***********@mic rosoft.com...
>I forgot to add that this must all be done programatically .

No user interface, no client.

I retrieve the data that I want to upload programatically and I must
somehow
create a HTTPWebRequest that will use a POST request and the
"multipart/form-data" content type.

"Paul" wrote:
>I need to programatically upload a text file to a web server using the
HTTPWebReque st object within .Net 2.0.

So far, I have determined that:

- I need a HTTP content-type of "multipart/form-data".
- I need to use the ContentType.Bou ndary property.

That is about as far as I have gotten.

I have searched long and far for examples to do this in .Net but I can
not
seem to find anything?

Does anyone have a code example or URL that I can look at to put the
pieces
of the puzzle together?

TIA

Jun 27 '08 #3
This is similar to what I am looking for but it doesn't address uploading a
file.

I am pretty certain I need to use the HTTP content-type of
"multipart/form-data" to programatically duplicate the manual process of
uploading the file.


"sloan" wrote:
This might not be correct, but check here:
http://groups.google.com/group/micro...13224a77b89add

I have "POST" code somewhere in that helper I think.

"Paul" <Pa**@discussio ns.microsoft.co mwrote in message
news:04******** *************** ***********@mic rosoft.com...
I forgot to add that this must all be done programatically .

No user interface, no client.

I retrieve the data that I want to upload programatically and I must
somehow
create a HTTPWebRequest that will use a POST request and the
"multipart/form-data" content type.

"Paul" wrote:
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 "multipart/form-data".
- I need to use the ContentType.Bou ndary property.

That is about as far as I have gotten.

I have searched long and far for examples to do this in .Net but I can
not
seem to find anything?

Does anyone have a code example or URL that I can look at to put the
pieces
of the puzzle together?

TIA


Jun 27 '08 #4

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

Similar topics

10
19362
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is able to fill that one out just fine. The second form is multipart/form-data. Unfortunately, I haven't been able to fill that out in a way that makes the server happy. I set up a copy of this form at my web site so that I could see exactly what a...
4
14526
by: R Reyes | last post by:
I am trying to code a file uploader (for forum/email attachments) from the client computer to a remote web server via the PUT method (since POST is not allowed ). However, the upload works ONLY when the file is inside a shared folder on my computer. If I try to upload from any other folder it does not work. Why is this? Reason being that whenever I upload files on other forums or websites I know I don't need to have my folder shared...
1
3179
by: Joey Chömpff | last post by:
Hello, When I'm uploading an file to a JRun WebServer (third party) with a Windows Forms application, l always get an TimeOut while uploading, all other request who doesn't request an post are going ok? Why? I've tried almost everything. I also tried the KB888528 solution but this also doesn't work. What can the KB887563 do for me? Machine( tried on Windows 2003 Server & WinXp)
2
1729
by: parseint | last post by:
Hi, Im trying to send a files using a HTTP POST request in my Window Application. I also have a progressbar that is being updated whil uploading. I have managed to send a file using HTTP PUT, but not HTT POST. I also want to send a username and password, as if it was get?username=myuser&pass=mypass. The WebForm1.aspx is from th following article http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q323246
4
15430
by: Shannon Hardin | last post by:
I'm trying to build a routine that will take a specified file from the user's local hard drive, and copy it to a remote server via WebDAV. I've tried using both HttpWebRequest and FileWebRequest, as outlined in some samples I found on MSDN and elsewhere, but so far have had no luck whatsoever. The copy process doesn't fail, but neither does the targeted file actually appear on the destination server. I have verified that I can copy...
0
1562
by: boxboy | last post by:
Hi, I'm writing a console application and am having a problem with HttpWebRequest when posting data to a webserver. A "System.Net.WebException: The server committed a protocol violation" is always being thrown when getting the response from a specific host. I'm pretty sure the framework's implementation doesn't like the formating or status code of the returned response header. It throws the exception without giving me a way of handling it...
4
12712
by: Natalia | last post by:
Hello, I need to provide the ability to post file and some form elements via our website (asp.net) to the third party website (asp page). On http://aspalliance.com/236#Page4 - I found great advices but still having troubles... it might some obvious error that I am making but I just dont see it. ==================FIRST - Webclient=================================
1
8048
by: Proogeren | last post by:
I have a problem with a httpwebrequest that I am creating. The request in itself looks correct but using fiddler I see that a www-authentication header is sent along as well. The code is pasted below. I do not add any www-authentication header here so I was wondering if anyone knows how to remove it. I have used almost 2 days trying to figure this out so help would be highly appreciated. CORRECT No proxy-authenticate header is present no...
5
8851
by: kamlesh20J | last post by:
Hello, I am trying to use HttpWebRequest to send some POST data I have accomplished this using: HttpWebRequest req = (HttpWebRequest) WebRequest.Create("http://mysite.com/index.php"); req.Method = "POST"; req.ContentType = "application/x-www-form-urlencoded"; string postData = "login=value1&pwd=value2&file=filename" req.ContentLength = postData.Length;
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9037
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.