473,785 Members | 3,388 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 2484

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
13304
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
1257
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
11039
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
8394
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
12503
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
9643
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
10147
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...
1
10087
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,...
1
7496
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
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
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
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.