NET.WEBCLIENT ERROR-HELP

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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_q...7782cURRENCYy=USD&id=1353381&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
 
Shiju said:
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_q...7782cURRENCYy=USD&id=1353381&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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top