473,779 Members | 2,038 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.Length ;contador++)
{
lblMensagem.Tex t = "Uploading files... ";

ws.UploadFile(" http://www.meusite.com .br/uploader.aspx", "POST",arqu ivos[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 2068
If it is just a matter of no authentication, you can simply set the
Credentials property to a new instance of a NetworkCredenti als 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.GetFi les("*.xml");

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

ws.UploadFile(" http://www.meusite.com .br/uploader.aspx", "POST",arqu ivos[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 NetworkCredenti als 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.GetFi les("*.xml");

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

ws.UploadFile(" http://www.meusite.com .br/uploader.aspx", "POST",arqu ivos[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
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
12502
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
10138
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
10074
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
9930
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...
1
7485
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
6724
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
5373
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
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
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
3
2869
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.