PC Review


Reply
Thread Tools Rate Thread

401 unauthorized message

 
 
Blasting Cap
Guest
Posts: n/a
 
      6th Mar 2008
I've got a web service that had been functioning up until I moved it to
a new server a while back.

It basically is a screen scrape that grabs off html off a UPS or Fedex
web page.

All of a sudden, I'm getting a 401 Unauthorized message when I try to
run it. So is another application that references this same web service.

When I moved IIS (2000 to server 2003), I copied & thought I had all the
websites set up exactly the same way. However, this web service has not
functioned and has repeatedly given this same error. The code that
actually gives the error is:

Case "UPSC"
sURL =
"http://wwwapps.ups.com/etracking/tracking.cgi?tracknums_displayed=5&TypeOfInquiryNumber=T&HTMLVersion=4.0&sort_by=status&InquiryNumber1="
& sBol(i) &
"&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&track=Track"
MyPage.Text = MyPage.Text +
oReadHTMPage.readHtmlPage(sURL, "UPSC", sBol(i), sTemp(i)con


The context of the error message is:

System.Net.WebException was unhandled by user code
Message="The request failed with HTTP status 401: Unauthorized."
Source="System.Web.Services"
StackTrace:
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at RemSQL.com.remlink.www.Tracker.UPS(String Nr)
at RemSQL.RemSQL.readHtmlPage(String url, String sCarr, String
sPro, String sPro1)
at test.POInquiry.BillofLading() in
C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1426
at test.POInquiry.ShowTracking() in
C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1497
at test.POInquiry.Tracking_Select(Object Sender, EventArgs E) in
C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1481
at
System.Web.UI.WebControls.BaseDataList.OnSelectedIndexChanged(EventArgs e)
at System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object
source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source,
EventArgs args)
at System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object
source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source,
EventArgs args)
at
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
at
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)



The reference.vb file that gets called eventually is:


<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.myserver.com/trackingstatus/UPS",
RequestNamespace:="http://www.myserver.com/trackingstatus",
ResponseNamespace:="http://www.myserver.com/trackingstatus",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
_
Public Function UPS(ByVal Nr As String) As Object
Dim results() As Object = Me.Invoke("UPS", New Object() {Nr})
Return CType(results(0),Object)
End Function


I've gone thru and changed the Anonymous access to enable it, both at
the folder level for the tracking status, as well as to temporarily
enabling anonymous access on the server (it needs to be NT Challenge
Response to access it).

How can I tell what entity is requesting authentication?

BC
 
Reply With Quote
 
 
 
 
nano2k
Guest
Posts: n/a
 
      7th Mar 2008
On 6 Mar, 20:33, Blasting Cap <goo...@christian.net> wrote:
> I've got a web service that had been functioning up until I moved it to
> a new server a while back.
>
> It basically is a screen scrape that grabs off html off a UPS or Fedex
> web page.
>
> All of a sudden, I'm getting a 401 Unauthorized message when I try to
> run it. *So is another application that references this same web service..
>
> When I moved IIS (2000 to server 2003), I copied & thought I had all the
> websites set up exactly the same way. *However, this web service has not
> functioned and has repeatedly given this same error. *The code that
> actually gives the error is:
>
> * * Case "UPSC"
> * * * * * * * * * * * * * * *sURL =
> "http://wwwapps.ups.com/etracking/tracking.cgi?tracknums_displayed=5&T...."
> & sBol(i) &
> "&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&track=Tra*ck"
> * * * * * * * * * * * * * * *MyPage.Text =MyPage.Text +
> oReadHTMPage.readHtmlPage(sURL, "UPSC", sBol(i), sTemp(i)con
>
> The context of the error message is:
>
> System.Net.WebException was unhandled by user code
> * *Message="The request failed with HTTP status 401: Unauthorized."
> * *Source="System.Web.Services"
> * *StackTrace:
> * * * * at
> System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClien*tMessage
> message, WebResponse response, Stream responseStream, Boolean asyncCall)
> * * * * at
> System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
> methodName, Object[] parameters)
> * * * * at RemSQL.com.remlink.www.Tracker.UPS(StringNr)
> * * * * at RemSQL.RemSQL.readHtmlPage(String url, String sCarr, String
> sPro, String sPro1)
> * * * * at test.POInquiry.BillofLading() in
> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1426
> * * * * at test.POInquiry.ShowTracking() in
> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1497
> * * * * at test.POInquiry.Tracking_Select(Object Sender, EventArgsE) in
> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1481
> * * * * at
> System.Web.UI.WebControls.BaseDataList.OnSelectedIndexChanged(EventArgs e)
> * * * * at System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object
> source, EventArgs e)
> * * * * at System.Web.UI.Control.RaiseBubbleEvent(Object source,
> EventArgs args)
> * * * * at System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object
> source, EventArgs e)
> * * * * at System.Web.UI.Control.RaiseBubbleEvent(Object source,
> EventArgs args)
> * * * * at
> System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
> * * * * at
> System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
> eventArgument)
> * * * * at
> System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.Ra*isePostBackEvent(String
> eventArgument)
> * * * * at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument)
> * * * * at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
> postData)
> * * * * at System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
>
> The reference.vb file that gets called eventually is:
>
> <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.myserver.com/trackingstatus/UPS",
> RequestNamespace:="http://www.myserver.com/trackingstatus",
> ResponseNamespace:="http://www.myserver.com/trackingstatus",
> Use:=System.Web.Services.Description.SoapBindingUse.Literal,
> ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
> * _
> * * * * *Public Function UPS(ByVal Nr As String) As Object
> * * * * * * *Dim results() As Object = Me.Invoke("UPS", New Object() {Nr})
> * * * * * * *Return CType(results(0),Object)
> * * * * *End Function
>
> I've gone thru and changed the Anonymous access to enable it, both at
> the folder level for the tracking status, as well as to temporarily
> enabling anonymous access on the server (it needs to be NT Challenge
> Response to access it).
>
> How can I tell what entity is requesting authentication?
>
> BC


Some checks to do:
1. NTFS access rights on files for NETWORK SERVICES user.
2. Go to IIS Console (Control Panel/Administrative Tools). Select your
site, go to properties, then select ASP.NET tab and check if the site
is enabled with the correct version.
 
Reply With Quote
 
Blasting Cap
Guest
Posts: n/a
 
      10th Mar 2008
I've tried both suggestions:

> Some checks to do:
> 1. NTFS access rights on files for NETWORK SERVICES user.
> 2. Go to IIS Console (Control Panel/Administrative Tools). Select your
> site, go to properties, then select ASP.NET tab and check if the site
> is enabled with the correct version.




both with zero success.

The site is set to the correct version (although it stopped working when
it was brought up to version 2), but I converted all the code and it
tested fine when I tested it. Now, I can't get it to work either in
test or production.

BC





nano2k wrote:
> On 6 Mar, 20:33, Blasting Cap <goo...@christian.net> wrote:
>> I've got a web service that had been functioning up until I moved it to
>> a new server a while back.
>>
>> It basically is a screen scrape that grabs off html off a UPS or Fedex
>> web page.
>>
>> All of a sudden, I'm getting a 401 Unauthorized message when I try to
>> run it. So is another application that references this same web service.
>>
>> When I moved IIS (2000 to server 2003), I copied & thought I had all the
>> websites set up exactly the same way. However, this web service has not
>> functioned and has repeatedly given this same error. The code that
>> actually gives the error is:
>>
>> Case "UPSC"
>> sURL =
>> "http://wwwapps.ups.com/etracking/tracking.cgi?tracknums_displayed=5&T..."
>> & sBol(i) &
>> "&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&track=Tra*ck"
>> MyPage.Text = MyPage.Text +
>> oReadHTMPage.readHtmlPage(sURL, "UPSC", sBol(i), sTemp(i)con
>>
>> The context of the error message is:
>>
>> System.Net.WebException was unhandled by user code
>> Message="The request failed with HTTP status 401: Unauthorized."
>> Source="System.Web.Services"
>> StackTrace:
>> at
>> System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClien*tMessage
>> message, WebResponse response, Stream responseStream, Boolean asyncCall)
>> at
>> System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
>> methodName, Object[] parameters)
>> at RemSQL.com.remlink.www.Tracker.UPS(StringNr)
>> at RemSQL.RemSQL.readHtmlPage(String url, String sCarr, String
>> sPro, String sPro1)
>> at test.POInquiry.BillofLading() in
>> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1426
>> at test.POInquiry.ShowTracking() in
>> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1497
>> at test.POInquiry.Tracking_Select(Object Sender, EventArgs E) in
>> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1481
>> at
>> System.Web.UI.WebControls.BaseDataList.OnSelectedIndexChanged(EventArgs e)
>> at System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object
>> source, EventArgs e)
>> at System.Web.UI.Control.RaiseBubbleEvent(Object source,
>> EventArgs args)
>> at System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object
>> source, EventArgs e)
>> at System.Web.UI.Control.RaiseBubbleEvent(Object source,
>> EventArgs args)
>> at
>> System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
>> at
>> System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
>> eventArgument)
>> at
>> System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.Ra*isePostBackEvent(String
>> eventArgument)
>> at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
>> sourceControl, String eventArgument)
>> at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
>> postData)
>> at System.Web.UI.Page.ProcessRequestMain(Boolean
>> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
>>
>> The reference.vb file that gets called eventually is:
>>
>> <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.myserver.com/trackingstatus/UPS",
>> RequestNamespace:="http://www.myserver.com/trackingstatus",
>> ResponseNamespace:="http://www.myserver.com/trackingstatus",
>> Use:=System.Web.Services.Description.SoapBindingUse.Literal,
>> ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
>> _
>> Public Function UPS(ByVal Nr As String) As Object
>> Dim results() As Object = Me.Invoke("UPS", New Object() {Nr})
>> Return CType(results(0),Object)
>> End Function
>>
>> I've gone thru and changed the Anonymous access to enable it, both at
>> the folder level for the tracking status, as well as to temporarily
>> enabling anonymous access on the server (it needs to be NT Challenge
>> Response to access it).
>>
>> How can I tell what entity is requesting authentication?
>>
>> BC

>
> Some checks to do:
> 1. NTFS access rights on files for NETWORK SERVICES user.
> 2. Go to IIS Console (Control Panel/Administrative Tools). Select your
> site, go to properties, then select ASP.NET tab and check if the site
> is enabled with the correct version.

 
Reply With Quote
 
Blasting Cap
Guest
Posts: n/a
 
      13th Mar 2008
Nano2k -

I finally got the problem fixed.

It was indirectly the issue you mentioned. Everything was as it should
have been when the system was moved over.

However, it wasn't until I went into the main site, and added a virtual
directory for the tracking service, that it actually started working.

The post that I found that put things together was this:

Creating a Virtual Directory
August 19, 2003 22:58 by admin

I always wondered what the differences were between creating virtual
directory using the IIS and through Windows Explorer (Web Sharing).

I found out today after spending over an hour trying to figure out why I
was getting this error when calling my web service from a windows
client: WebException: The request failed with HTTP status 401: Unauthorized

The reason is that when you create a Virtual Directory through IIS the
default permission for the directory is Anonymous but when using Windows
Explorer the default permission is set to Integrated Window Authentication.

located here:
http://www.merill.net/category/ASPNET.aspx


The virtual directory was copied using Windows Explorer, and it wasn't
until I did the exact same thing via IIS, that the $#$(*&$# thing
started working.

I have no idea why one would make any difference than the other - by
creating it in IIS, it changed nothing on the properties of the virtual
directory that I can see.

Thanks for the help.

BC




nano2k wrote:
> On 6 Mar, 20:33, Blasting Cap <goo...@christian.net> wrote:
>> I've got a web service that had been functioning up until I moved it to
>> a new server a while back.
>>
>> It basically is a screen scrape that grabs off html off a UPS or Fedex
>> web page.
>>
>> All of a sudden, I'm getting a 401 Unauthorized message when I try to
>> run it. So is another application that references this same web service.
>>
>> When I moved IIS (2000 to server 2003), I copied & thought I had all the
>> websites set up exactly the same way. However, this web service has not
>> functioned and has repeatedly given this same error. The code that
>> actually gives the error is:
>>
>> Case "UPSC"
>> sURL =
>> "http://wwwapps.ups.com/etracking/tracking.cgi?tracknums_displayed=5&T..."
>> & sBol(i) &
>> "&InquiryNumber2=&InquiryNumber3=&InquiryNumber4=&InquiryNumber5=&track=Tra*ck"
>> MyPage.Text = MyPage.Text +
>> oReadHTMPage.readHtmlPage(sURL, "UPSC", sBol(i), sTemp(i)con
>>
>> The context of the error message is:
>>
>> System.Net.WebException was unhandled by user code
>> Message="The request failed with HTTP status 401: Unauthorized."
>> Source="System.Web.Services"
>> StackTrace:
>> at
>> System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClien*tMessage
>> message, WebResponse response, Stream responseStream, Boolean asyncCall)
>> at
>> System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
>> methodName, Object[] parameters)
>> at RemSQL.com.remlink.www.Tracker.UPS(StringNr)
>> at RemSQL.RemSQL.readHtmlPage(String url, String sCarr, String
>> sPro, String sPro1)
>> at test.POInquiry.BillofLading() in
>> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1426
>> at test.POInquiry.ShowTracking() in
>> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1497
>> at test.POInquiry.Tracking_Select(Object Sender, EventArgs E) in
>> C:\Inetpub\wwwroot\test\Sales\POInquiry.aspx.vb:line 1481
>> at
>> System.Web.UI.WebControls.BaseDataList.OnSelectedIndexChanged(EventArgs e)
>> at System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object
>> source, EventArgs e)
>> at System.Web.UI.Control.RaiseBubbleEvent(Object source,
>> EventArgs args)
>> at System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object
>> source, EventArgs e)
>> at System.Web.UI.Control.RaiseBubbleEvent(Object source,
>> EventArgs args)
>> at
>> System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
>> at
>> System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
>> eventArgument)
>> at
>> System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.Ra*isePostBackEvent(String
>> eventArgument)
>> at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
>> sourceControl, String eventArgument)
>> at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
>> postData)
>> at System.Web.UI.Page.ProcessRequestMain(Boolean
>> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
>>
>> The reference.vb file that gets called eventually is:
>>
>> <System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.myserver.com/trackingstatus/UPS",
>> RequestNamespace:="http://www.myserver.com/trackingstatus",
>> ResponseNamespace:="http://www.myserver.com/trackingstatus",
>> Use:=System.Web.Services.Description.SoapBindingUse.Literal,
>> ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
>> _
>> Public Function UPS(ByVal Nr As String) As Object
>> Dim results() As Object = Me.Invoke("UPS", New Object() {Nr})
>> Return CType(results(0),Object)
>> End Function
>>
>> I've gone thru and changed the Anonymous access to enable it, both at
>> the folder level for the tracking status, as well as to temporarily
>> enabling anonymous access on the server (it needs to be NT Challenge
>> Response to access it).
>>
>> How can I tell what entity is requesting authentication?
>>
>> BC

>
> Some checks to do:
> 1. NTFS access rights on files for NETWORK SERVICES user.
> 2. Go to IIS Console (Control Panel/Administrative Tools). Select your
> site, go to properties, then select ASP.NET tab and check if the site
> is enabled with the correct version.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
401 unauthorized message =?Utf-8?B?cmFjZWx2ZXIwOA==?= Windows XP Help 2 26th Feb 2007 10:47 PM
401 unauthorized message =?Utf-8?B?cmFjZWx2ZXIwOA==?= Windows XP Help 0 26th Feb 2007 02:11 PM
401 Unauthorized error message =?Utf-8?B?QWxpYXM=?= Windows XP Internet Explorer 2 28th Sep 2005 06:59 PM
Unauthorized?? =?Utf-8?B?TXJHaWI=?= Windows XP Security 1 23rd Mar 2005 01:55 PM
unauthorized use Kelson Roberts Microsoft Windows 2000 Networking 0 27th Jul 2004 03:06 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:23 PM.