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

The remote server returned an error: (401)

Hi,

This is driving me crazy. I have a solution that works great on one site,
but doesn't on another site. Same exact code on two different windows
environments. Here is the code:

Private Sub DoStuff()
Dim sURL As String
Dim XMLnews As XmlDocument = New XmlDocument
Dim XMLroot As System.Xml.XmlElement
Dim XMLHeadline As System.Xml.XmlNode
Dim XMLnode As System.Xml.XmlNode
Dim sFeed As String
Try

sURL = "http://www.microsoft.com/"
Dim myHttpWebRequest As HttpWebRequest =
CType(WebRequest.Create(sURL), HttpWebRequest)
myHttpWebRequest.Proxy = System.Net.WebProxy.GetDefaultProxy

Dim myHttpWebResponse As HttpWebResponse =
CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
Dim receiveStream As Stream =
myHttpWebResponse.GetResponseStream()
Dim encode As System.Text.Encoding =
System.Text.Encoding.GetEncoding("utf-8")
Dim readStream As New StreamReader(receiveStream, encode)
skinerror.Text = readStream.ReadToEnd.ToString

Catch ex As Exception
skinerror.Text = ex.Message.ToString & "<br>" &
ex.StackTrace.ToString
End Try

End Sub

On the good site it returns the web page (in this case Microsoft.com's home
page). On the bad site (hosted by godaddy.com) it returns:
The remote server returned an error: (401) Unauthorized.
at System.Net.HttpWebRequest.CheckFinalStatus() at
System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) at
System.Net.HttpWebRequest.GetResponse() at webapp._Default.DoStuff()

I am not using credentials of any kind -- it doesn't matter what website I
point to either.

I'm at a loss -- thanks in advance.

Nov 19 '05 #1
3 2107
401 is access denied. as the actual site does not require authenication, the
authenication request is coming from the proxy server. godaddy's proxy may
complety block outgoing traffic, or may require a login. check with their
technical support
-- bruce (sqlwork.com)
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
| Hi,
|
| This is driving me crazy. I have a solution that works great on one site,
| but doesn't on another site. Same exact code on two different windows
| environments. Here is the code:
|
| Private Sub DoStuff()
| Dim sURL As String
| Dim XMLnews As XmlDocument = New XmlDocument
| Dim XMLroot As System.Xml.XmlElement
| Dim XMLHeadline As System.Xml.XmlNode
| Dim XMLnode As System.Xml.XmlNode
| Dim sFeed As String
| Try
|
| sURL = "http://www.microsoft.com/"
| Dim myHttpWebRequest As HttpWebRequest =
| CType(WebRequest.Create(sURL), HttpWebRequest)
| myHttpWebRequest.Proxy = System.Net.WebProxy.GetDefaultProxy
|
| Dim myHttpWebResponse As HttpWebResponse =
| CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
| Dim receiveStream As Stream =
| myHttpWebResponse.GetResponseStream()
| Dim encode As System.Text.Encoding =
| System.Text.Encoding.GetEncoding("utf-8")
| Dim readStream As New StreamReader(receiveStream, encode)
| skinerror.Text = readStream.ReadToEnd.ToString
|
| Catch ex As Exception
| skinerror.Text = ex.Message.ToString & "<br>" &
| ex.StackTrace.ToString
| End Try
|
| End Sub
|
| On the good site it returns the web page (in this case Microsoft.com's
home
| page). On the bad site (hosted by godaddy.com) it returns:
|
|
| The remote server returned an error: (401) Unauthorized.
| at System.Net.HttpWebRequest.CheckFinalStatus() at
| System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) at
| System.Net.HttpWebRequest.GetResponse() at webapp._Default.DoStuff()
|
| I am not using credentials of any kind -- it doesn't matter what website I
| point to either.
|
| I'm at a loss -- thanks in advance.
|
Nov 19 '05 #2
I have a request into them about exactly that. If it is a proxy, how would I
setup the code the use the username/password properly?

Thanks for the response

Paul

"bruce barker" wrote:
401 is access denied. as the actual site does not require authenication, the
authenication request is coming from the proxy server. godaddy's proxy may
complety block outgoing traffic, or may require a login. check with their
technical support
-- bruce (sqlwork.com)
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
| Hi,
|
| This is driving me crazy. I have a solution that works great on one site,
| but doesn't on another site. Same exact code on two different windows
| environments. Here is the code:
|
| Private Sub DoStuff()
| Dim sURL As String
| Dim XMLnews As XmlDocument = New XmlDocument
| Dim XMLroot As System.Xml.XmlElement
| Dim XMLHeadline As System.Xml.XmlNode
| Dim XMLnode As System.Xml.XmlNode
| Dim sFeed As String
| Try
|
| sURL = "http://www.microsoft.com/"
| Dim myHttpWebRequest As HttpWebRequest =
| CType(WebRequest.Create(sURL), HttpWebRequest)
| myHttpWebRequest.Proxy = System.Net.WebProxy.GetDefaultProxy
|
| Dim myHttpWebResponse As HttpWebResponse =
| CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
| Dim receiveStream As Stream =
| myHttpWebResponse.GetResponseStream()
| Dim encode As System.Text.Encoding =
| System.Text.Encoding.GetEncoding("utf-8")
| Dim readStream As New StreamReader(receiveStream, encode)
| skinerror.Text = readStream.ReadToEnd.ToString
|
| Catch ex As Exception
| skinerror.Text = ex.Message.ToString & "<br>" &
| ex.StackTrace.ToString
| End Try
|
| End Sub
|
| On the good site it returns the web page (in this case Microsoft.com's
home
| page). On the bad site (hosted by godaddy.com) it returns:
|
|
| The remote server returned an error: (401) Unauthorized.
| at System.Net.HttpWebRequest.CheckFinalStatus() at
| System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) at
| System.Net.HttpWebRequest.GetResponse() at webapp._Default.DoStuff()
|
| I am not using credentials of any kind -- it doesn't matter what website I
| point to either.
|
| I'm at a loss -- thanks in advance.
|

Nov 19 '05 #3
Well, this is getting ridiculous....

The host says their proxy works fine -- no authentication.

Why doesn't micorosoft provide details on the authentication issue ??????

Such as "where" the 401 is received from ?

Anyone with advanced knowledge of this type of issue would be helpful...

thanks,
paul

"Paul" wrote:
I have a request into them about exactly that. If it is a proxy, how would I
setup the code the use the username/password properly?

Thanks for the response

Paul

"bruce barker" wrote:
401 is access denied. as the actual site does not require authenication, the
authenication request is coming from the proxy server. godaddy's proxy may
complety block outgoing traffic, or may require a login. check with their
technical support
-- bruce (sqlwork.com)
"Paul" <Pa**@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
| Hi,
|
| This is driving me crazy. I have a solution that works great on one site,
| but doesn't on another site. Same exact code on two different windows
| environments. Here is the code:
|
| Private Sub DoStuff()
| Dim sURL As String
| Dim XMLnews As XmlDocument = New XmlDocument
| Dim XMLroot As System.Xml.XmlElement
| Dim XMLHeadline As System.Xml.XmlNode
| Dim XMLnode As System.Xml.XmlNode
| Dim sFeed As String
| Try
|
| sURL = "http://www.microsoft.com/"
| Dim myHttpWebRequest As HttpWebRequest =
| CType(WebRequest.Create(sURL), HttpWebRequest)
| myHttpWebRequest.Proxy = System.Net.WebProxy.GetDefaultProxy
|
| Dim myHttpWebResponse As HttpWebResponse =
| CType(myHttpWebRequest.GetResponse(), HttpWebResponse)
| Dim receiveStream As Stream =
| myHttpWebResponse.GetResponseStream()
| Dim encode As System.Text.Encoding =
| System.Text.Encoding.GetEncoding("utf-8")
| Dim readStream As New StreamReader(receiveStream, encode)
| skinerror.Text = readStream.ReadToEnd.ToString
|
| Catch ex As Exception
| skinerror.Text = ex.Message.ToString & "<br>" &
| ex.StackTrace.ToString
| End Try
|
| End Sub
|
| On the good site it returns the web page (in this case Microsoft.com's
home
| page). On the bad site (hosted by godaddy.com) it returns:
|
|
| The remote server returned an error: (401) Unauthorized.
| at System.Net.HttpWebRequest.CheckFinalStatus() at
| System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult) at
| System.Net.HttpWebRequest.GetResponse() at webapp._Default.DoStuff()
|
| I am not using credentials of any kind -- it doesn't matter what website I
| point to either.
|
| I'm at a loss -- thanks in advance.
|

Nov 19 '05 #4

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

Similar topics

0
by: sirumalla | last post by:
These posting i have seen in so many sites but none of them solved the problem. Iam trying to fix this problem past 2 days but iam not able to do so. I doubt whether iam missing any peice of code ...
2
by: obeOnline | last post by:
I'm getting the following error... System.Net.HttpWebRequest.CheckFinalStatus() +676 System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +139...
0
by: sirumalla | last post by:
These posting i have seen in so many sites but none of them solved the problem. Iam trying to fix this problem past 2 days but iam not able to do so. I doubt whether iam missing any peice of code ...
0
by: nidhisahu | last post by:
Hello All, i am open this URL( http://id.skootit.com/WorkspaceService/ListInvitations?actor=http://goku.id.skootit.com/) directly in browser with enter credential then its open and show...
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
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
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
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...
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,...
0
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...

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.