473,795 Members | 2,452 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with System.Net.WebC lient

Hi!

I have a program that excutes the following code:

DirectoryInfo diretorio = new DirectoryInfo(@ "C:\teste") ;
FileInfo[] arquivos = diretorio.GetFi les("*.xml");

for(int contador=0;cont ador<arquivos.L ength;contador+ +)
{
lblMensagem.Tex t = "Uploading files... ";

ws.UploadFile(" http://www.meusite.com .br/uploader.aspx", "POST",arqu ivos[contador].FullName);
}

lblMensagem.Tex t = "Success!";

As you can see i've got a webpage that receives those files and saves on the
apropriate directory.

This code works when I'm running it on my machine. When I specify the link
to http://localhost/meusite/uploader.aspx the files are uploaded with no
errors but when i change the link to http://www.meusite.com.br/uploader.aspx
the following error appears:

"The remote server returned an error: (500) Internal Server Error."

Can anybody help me?

Thanks
--
Bruno
Sep 29 '05 #1
3 2485

It looks to me like you have not set the appropiate permissions so that the
ASPNET worker process can save the files to the directory. Change the
settings in your browser so you don't get "friendly errors" so you can see
the actual error message.

I don't remember off the top of my head, but I believe you have to add the
ASPNET account to the folder you intend to upload the files to and give it
full rights. Don't take my word for it though, find an article about it
online, it is not hard, just search for something like ".NET cannot upload
file".

Good luck!

--
Juan Romero
-----------------------------------------
The successful person has the habit of doing the things failures don't like
to do.
E.M. Gray
"Bruno Otero" wrote:
Hi!

I have a program that excutes the following code:

DirectoryInfo diretorio = new DirectoryInfo(@ "C:\teste") ;
FileInfo[] arquivos = diretorio.GetFi les("*.xml");

for(int contador=0;cont ador<arquivos.L ength;contador+ +)
{
lblMensagem.Tex t = "Uploading files... ";

ws.UploadFile(" http://www.meusite.com .br/uploader.aspx", "POST",arqu ivos[contador].FullName);
}

lblMensagem.Tex t = "Success!";

As you can see i've got a webpage that receives those files and saves on the
apropriate directory.

This code works when I'm running it on my machine. When I specify the link
to http://localhost/meusite/uploader.aspx the files are uploaded with no
errors but when i change the link to http://www.meusite.com.br/uploader.aspx
the following error appears:

"The remote server returned an error: (500) Internal Server Error."

Can anybody help me?

Thanks
--
Bruno

Sep 29 '05 #2
Thanks for your help Juan, but my problem isn't on the web site, i've some
other pages that uploads some files and they all work fine. The problem here
is with the Windows Forms that i've programmed to use the UploadFile method
from the System.Net.WebC lient class.

--
Bruno
"Madestro" wrote:

It looks to me like you have not set the appropiate permissions so that the
ASPNET worker process can save the files to the directory. Change the
settings in your browser so you don't get "friendly errors" so you can see
the actual error message.

I don't remember off the top of my head, but I believe you have to add the
ASPNET account to the folder you intend to upload the files to and give it
full rights. Don't take my word for it though, find an article about it
online, it is not hard, just search for something like ".NET cannot upload
file".

Good luck!

--
Juan Romero
-----------------------------------------
The successful person has the habit of doing the things failures don't like
to do.
E.M. Gray
"Bruno Otero" wrote:
Hi!

I have a program that excutes the following code:

DirectoryInfo diretorio = new DirectoryInfo(@ "C:\teste") ;
FileInfo[] arquivos = diretorio.GetFi les("*.xml");

for(int contador=0;cont ador<arquivos.L ength;contador+ +)
{
lblMensagem.Tex t = "Uploading files... ";

ws.UploadFile(" http://www.meusite.com .br/uploader.aspx", "POST",arqu ivos[contador].FullName);
}

lblMensagem.Tex t = "Success!";

As you can see i've got a webpage that receives those files and saves on the
apropriate directory.

This code works when I'm running it on my machine. When I specify the link
to http://localhost/meusite/uploader.aspx the files are uploaded with no
errors but when i change the link to http://www.meusite.com.br/uploader.aspx
the following error appears:

"The remote server returned an error: (500) Internal Server Error."

Can anybody help me?

Thanks
--
Bruno

Sep 29 '05 #3

Bruno,

Your problem IS on the web site. The error message you posted is a response
from the server. The 500 code means there is something wrong with the
application you are running on the server. That is why it says "Internal
server error." Trust me, the error is happening on the server side. You may
be getting an error on your application, but that is probably because the
WebClient did not get a valid response from the server.
--
Juan Romero
-----------------------------------------
The successful person has the habit of doing the things failures don't like
to do.
E.M. Gray
"Bruno Otero" wrote:
Thanks for your help Juan, but my problem isn't on the web site, i've some
other pages that uploads some files and they all work fine. The problem here
is with the Windows Forms that i've programmed to use the UploadFile method
from the System.Net.WebC lient class.

--
Bruno
"Madestro" wrote:

It looks to me like you have not set the appropiate permissions so that the
ASPNET worker process can save the files to the directory. Change the
settings in your browser so you don't get "friendly errors" so you can see
the actual error message.

I don't remember off the top of my head, but I believe you have to add the
ASPNET account to the folder you intend to upload the files to and give it
full rights. Don't take my word for it though, find an article about it
online, it is not hard, just search for something like ".NET cannot upload
file".

Good luck!

--
Juan Romero
-----------------------------------------
The successful person has the habit of doing the things failures don't like
to do.
E.M. Gray
"Bruno Otero" wrote:
Hi!

I have a program that excutes the following code:

DirectoryInfo diretorio = new DirectoryInfo(@ "C:\teste") ;
FileInfo[] arquivos = diretorio.GetFi les("*.xml");

for(int contador=0;cont ador<arquivos.L ength;contador+ +)
{
lblMensagem.Tex t = "Uploading files... ";

ws.UploadFile(" http://www.meusite.com .br/uploader.aspx", "POST",arqu ivos[contador].FullName);
}

lblMensagem.Tex t = "Success!";

As you can see i've got a webpage that receives those files and saves on the
apropriate directory.

This code works when I'm running it on my machine. When I specify the link
to http://localhost/meusite/uploader.aspx the files are uploaded with no
errors but when i change the link to http://www.meusite.com.br/uploader.aspx
the following error appears:

"The remote server returned an error: (500) Internal Server Error."

Can anybody help me?

Thanks
--
Bruno

Sep 29 '05 #4

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

Similar topics

11
942
by: ptass | last post by:
Hi I've installed win2k3 sp1 on a machine where an openRead on any given file was previously working. After installation, I get a webException as follows... ..message "An exception occurred during a webclient request" .._Hresult = "-2146233079" .._COMPlusExceptionCode ="-532459699" Sorry I don't have the whole error, but this seems to be the only pertinent
2
5369
by: xzzy | last post by:
I have .net 1.1 c# . . . . . using System.Net only lists sockets what do I need to do to be able to do: using System.Net.WebClient;
6
13305
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + fileID.ToString() + ".pdf");
0
1480
by: David W | last post by:
I am trying to upload a file from a user's system to my web server. I found code using the WebClient.UploadFile method. However, the uploaded file is from the server's hard drive not the user's system. I don't want to use the input file method (as this will force the user to do unnessecary browsing and I know where the file will be: c:\test.txt for example). I am sure that I am just missing something simple. However, I can not figure...
0
4089
by: Kumar | last post by:
Hi all, I have the following code which uses WebClient.UploadValues myNameValueCollection.Add("Name", name) myNameValueCollection.Add("Age", age) .............. ............. Dim web As New System.Net.WebClient web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
2
1258
by: Jerry Spence1 | last post by:
I am trying to get a jpg image as follows: Dim Client As System.Net.WebClient = New System.Net.WebClient Client.DownloadFile("http://root:<password>@192.168.0.99/cgi-bin/video.jpg", MyFilename) However I understand that IE no longer supports this 'in-line' presentation of the username and password strings. Indeed I am getting a "Not Authorized" error being returned.
3
11049
by: df | last post by:
Hi, I'm trying to download the web page source code from a HTTPS URL, my code is as follows: Code: System.Net.WebClient WC = new System.Net.WebClient(); NetworkCredential Cred = new NetworkCredential();
3
8395
by: Giggi | last post by:
Hi! I need to pass some strings via an HTTP POST from page1 (in my app) to a page on another server. I stored my data in a NameValueCollection and then sent it using WebClient.UploadValues. Everything works fine but if one of the string contains a european character (èéòàù...) it's not sent correctly and the char is received as a '?' I read at least 20 different posts on similiar problem but didn't find a solution yet.
1
12505
by: Mike | last post by:
I am using PowerShell to download an XML file into a string using the DownloadString(URI) method of System.Net.WebClient object. Sample commands below: $Result = $Null; $WebClient = new-object System.Net.WebClient; $WebClient.Encoding = ::Default; $WebClient.Proxy = ::DefaultWebProxy; $WebClient.Proxy.Credentials = ::DefaultCredentials;
3
1558
by: kpg | last post by:
(Multi-post from microsoft.public.dotnet.framework.aspnet.webservices, Please apply all applicable pardons.) Hi all, I have a web service that FTPs data it receives to a third party FTP site. The web service will upload to the FTP site 12 times. The 13th time it will timeout. Once the web service is reset - that is
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
10437
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...
0
10214
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10001
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
9042
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...
1
7538
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
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();...
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.