473,396 Members | 2,036 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,396 software developers and data experts.

NET.WEBCLIENT ERROR-HELP

Hello everybody,
I am using the the below mentioned packages for sending the mail, but when i
assign the read file to a byte array " barr = wc.DownloadData(url)"

I get an error "The remote server returned an error: (401) Unauthorized."
,so can nayone of you tell me waht could be the reason for the error and how
it can be rectified.

*************************
code for your perusal

Imports System.Web.Mail
Imports System.Net

Dim wc As New WebClient
Dim url As String = String.Empty
url =
"http://localhost/Tradenet/booking_quotation_sendmail.aspx?searchgrid=n&agenc yid=1003412&exchangerate=3.67782cURRENCYy=USD&id=1 353381&StaffID=TMK00392"

Dim barr() As Byte
barr = wc.DownloadData(url)

"The remote server returned an error: (401) Unauthorized."


****************************

your expert advise would be of great help.

rgds
Shiju

Nov 18 '05 #1
1 2079
Shiju Poyilil wrote:
Hello everybody,
I am using the the below mentioned packages for sending the mail, but when i
assign the read file to a byte array " barr = wc.DownloadData(url)"

I get an error "The remote server returned an error: (401) Unauthorized."
,so can nayone of you tell me waht could be the reason for the error and how
it can be rectified.

*************************
code for your perusal

Imports System.Web.Mail
Imports System.Net

Dim wc As New WebClient
Dim url As String = String.Empty
url =
"http://localhost/Tradenet/booking_quotation_sendmail.aspx?searchgrid=n&agenc yid=1003412&exchangerate=3.67782cURRENCYy=USD&id=1 353381&StaffID=TMK00392"

Dim barr() As Byte
barr = wc.DownloadData(url)

"The remote server returned an error: (401) Unauthorized."


****************************

your expert advise would be of great help.

rgds
Shiju

It has something to do with security settings. Probably you're accessing
your localhost webapp with other credentials than the request to the url
above.

The url mentioned will be accessed with ASPNET (WinXP) user or the
NETWORK SERVICE (Win2003). So check your rights or provide a
username/pass in your code.

--

//Rutger

DoDotNet@KICKTHIS_Gmail.com
www.RutgerSmit.com
Nov 18 '05 #2

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

Similar topics

4
by: Justin Malloy | last post by:
I am using the System.Net.Webclient to try and download an XML file from a website but am receiving a HTTP protocol error when running the DownloadFile() sub routine. I did a HTTP trace using...
0
by: Helen Abell | last post by:
Hi, I am trying to use a .Net WebClient object to read data from a url, but I am getting the following error: System.Net.HttpWebRequest.CheckFinalStatus()...
0
by: pascal_dumont | last post by:
Hi all, I have a problem with downloading files by using WebClient wc = new WebClient(); wc.DownloadFile("http://some_url.com/some_file.gif", "some_file.gif"); This returns the error 403...
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...
1
by: yyy | last post by:
This problem bothers me for a long time: I use WebClient.DownloadData in order to read text from an HTML document this way: WebClient c = new WebClient(); string html=...
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...
0
by: Saverio Tedeschi | last post by:
Hi all gurus, forgive me if I submit a 2nd post, but I'm no more able to see my question. So: I wrote an Win app with embedded FTP client (well, made some cut and paste from others' projects :-))...
1
by: Phillip N Rounds | last post by:
I'm having problems using the WebClient.UploadFile() command. I have MySender.ASPX which is supposed to upload two files to the server. There is also ConsumeFileUpload.aspx which is intended to...
1
by: Mad Scientist Jr | last post by:
For some reason I can't get a WebClient to access an outside URL from behind our firewall. The code works when it runs outside the firewall. I turned on windows authentication in the web.config...
5
by: Svinja | last post by:
Hi, i am using WebClient.UploadFile to upload a file on my web page, code: WebClient webClient = new WebClient(); webClient.Credentials = new NetworkCredential(userName, pass);...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
0
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...

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.