401 unauthorized message

B

Blasting Cap

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/tr...TMLVersion=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
 
N

nano2k

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.
 
B

Blasting Cap

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




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.
 
B

Blasting Cap

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



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.
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top