473,698 Members | 2,322 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upload a text file thru webclient

Hi
i am trying to upload a txt file thru this code, but its not updating
the data. is this code fine.
Or can anybody please suggest me some other meathod to do the same.
its urgent please help

regards
shantanu

WebClient client = new WebClient();
client.Credenti als = netCred;
client.Headers. Add("Content-Type","applicat ion/x-www-form-
urlencoded");
client.UploadFi le("http://aww.ngn.bel.alc atel.be/prp/cgi-bin/secure/
ImportForm.cgi" ,"POST",@"C:\PR P\PRPTemp.txt") ;

Jun 20 '07
12 2079
Well, from your stack trace it doesn't seem to be using it... I'm
confused as to why you are doubling up on setting headers anyway:
surely .Credentials should manage the Authorization header (so why set
twice?) Likewise, the content-type of a file upload isn't application/
x-www-form-urlencoded, but multipart/form-data. You don't should
netCred being initialized, but I can't see why this isn't playing
ball...

Marc
Jun 22 '07 #11
On Jun 22, 12:01 pm, Marc Gravell <marc.grav...@g mail.comwrote:
Well, from your stack trace it doesn't seem to be using it... I'm
confused as to why you are doubling up on setting headers anyway:
surely .Credentials should manage the Authorization header (so why set
twice?) Likewise, the content-type of a file upload isn't application/
x-www-form-urlencoded, but multipart/form-data. You don't should
netCred being initialized, but I can't see why this isn't playing
ball...

Marc
thanx marc
but any how is it possible that the server is not providing the
sufficient rights to upload the data in this way.I was reading in some
article that the portal should me deployed in a anonymous mode. Is it
true.??
regards
shantanu

Jun 22 '07 #12
On Jun 22, 2:10 pm, shantanu <shantanuse...@ gmail.comwrote:
On Jun 22, 12:01 pm, Marc Gravell <marc.grav...@g mail.comwrote:
Well, from your stack trace it doesn't seem to be using it... I'm
confused as to why you are doubling up on setting headers anyway:
surely .Credentials should manage the Authorization header (so why set
twice?) Likewise, the content-type of a file upload isn't application/
x-www-form-urlencoded, but multipart/form-data. You don't should
netCred being initialized, but I can't see why this isn't playing
ball...
Marc

thanx marc
but any how is it possible that the server is not providing the
sufficient rights to upload the data in this way.I was reading in some
article that the portal should me deployed in a anonymous mode. Is it
true.??
regardsshantanu
Hi
I am still waiting for the resolution kindly help
regards
shantanu

Jul 2 '07 #13

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

Similar topics

4
9714
by: Shawn Mesiatowsky | last post by:
I have an html form that accepts a file for uploading, but I wanted to create a program to automate the upload procedure. I beileive you use the Webresponse class, but I was not sure how to use this class to post a file to a specified website. In some documentation I have, it also specifies the Request Header must be: Content-type: application/octet-stream here is the web site html code: <form action=post method=post...
5
103602
by: John Lee | last post by:
Hi, I have a simple web page that allow file to be uploaded, the upload page looks like the following: <form method="post" name="upload" enctype="multipart/form-data" action="processupload.aspx"> <input type=checkbox name="chkOverride" value="1"> <input type=file name="filename"> <input type=submit value="Upload Data File" name="cmdSubmit">
0
1277
by: Kannan | last post by:
Hello, I was trying to upload a local file on a client machine to a sharepoint folder using the WebClient object. This method is present in a client side DLL. I need to upload the document using NTLM authentication. The method does not report any errors but the document does not appear in the folder. Here are the the two code snippets that I am working on and tested
3
2429
by: Brian | last post by:
Hi, I've been trying to find a way to upload file to another site that is not using IIS. The site that I want to upload file to has a simple php script to receive file uploaded through standard http post with a file upload. However, how do I upload file to the site using asp.net? thanks Brian
5
737
by: Neo | last post by:
Hello, I am receiving a file as a binary stream from a C++ Client Application. >From the application, the file is being sent as a "Multipart/form-data". I want to receive this file on the server, for which i am using Request.Inputstream and reading it into a byte array. This is not working as it is coupling the binary content with some Boundary and text such as "Content-Disposition:
0
362
by: shantanu | last post by:
Hi i am trying to upload a txt file thru this code, but its not updating the data. is this code fine. Or can anybody please suggest me some other meathod to do the same. its urgent please help regards shantanu WebClient client = new WebClient();
5
3663
by: shantanu | last post by:
Hi i am trying to upload a txt file thru this code, but its not updating the data. is this code fine. Or can anybody please suggest me some other meathod to do the same. its urgent please help regards shantanu
21
34412
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
3
4295
by: =?Utf-8?B?dmFzaW1v?= | last post by:
Have the following code: wkLocalPath = "C:\A\1.jpg" wkServerPath = "http://servername/dirname/1.jpg" wcClient.Credentials = New NetworkCredential("UID", "PW") wcClient.UploadFile(wkServerPath, "PUT", wkLocalPath) File exists on C. Dir exist on server (ASPNET user and Admin user have full rights) (tried both) Created virtual for Dirname and gave it write access in properties) "POST" gives same results.
0
8608
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
9164
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
8898
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
8870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7734
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
5860
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();...
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
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.