473,395 Members | 1,791 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,395 software developers and data experts.

Problems with System.Net.WebClient

Hi!

I have a program that excutes the following code:

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

for(int contador=0;contador< arquivos.Length;contador++)
{
lblMensagem.Text = "Uploading files... ";

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

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."

I think that is going on because i haven't set up the right
credentials, ou authorisation to access the server... but, how can i do
it?

Can anybody help me?

Thanks

Nov 17 '05 #1
2 2050
If it is just a matter of no authentication, you can simply set the
Credentials property to a new instance of a NetworkCredentials class that
contains your authentication information... unfortunately, I doubt that
authentication is your issue as a failure with that should result in an error
code of 401.

Given the error you are seeing, I would suggest doing some debugging on your
server side and attempt to figure out exactly why that is occurring there.
Any chance of enabling some logging on the page that is receiving your upload
POST?

Brendan
"Pepe" wrote:
Hi!

I have a program that excutes the following code:

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

for(int contador=0;contador< arquivos.Length;contador++)
{
lblMensagem.Text = "Uploading files... ";

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

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."

I think that is going on because i haven't set up the right
credentials, ou authorisation to access the server... but, how can i do
it?

Can anybody help me?

Thanks

Nov 17 '05 #2
Brendan,

I can't do some debugging on the server side because i don't have the
right access to it. I can only deploy my web page over there.

I've tried to make these things with the credentials but it failed... I
don't know if i've done it right, can you give me an exemple?

The other suggestion that you gave me was to make some logging on the
page. That i can do.. i'll make the arrangements and as soon as i have
an answer i'll post it over here.

Thanks
Brendan Grant wrote:
If it is just a matter of no authentication, you can simply set the
Credentials property to a new instance of a NetworkCredentials class that
contains your authentication information... unfortunately, I doubt that
authentication is your issue as a failure with that should result in an error
code of 401.

Given the error you are seeing, I would suggest doing some debugging on your
server side and attempt to figure out exactly why that is occurring there.
Any chance of enabling some logging on the page that is receiving your upload
POST?

Brendan
"Pepe" wrote:
Hi!

I have a program that excutes the following code:

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

for(int contador=0;contador< arquivos.Length;contador++)
{
lblMensagem.Text = "Uploading files... ";

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

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."

I think that is going on because i haven't set up the right
credentials, ou authorisation to access the server... but, how can i do
it?

Can anybody help me?

Thanks


Nov 17 '05 #3

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

Similar topics

11
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...
2
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
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 =...
0
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...
0
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...
2
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)...
3
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...
3
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....
1
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...
3
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....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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,...

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.