S
Stephany Young
When the Web site and Web Service application are set to allow Anonymous
access, the following code works perfectly when used in both a Desktop
application and a Pocket PC 2003 application.
Imports System.Net
Imports <web reference>
Private Sub CallHelloWorld()
Label1.Text = String.Empty
Label1.Update()
Dim _ws As <web service> = New <web service>
Label1.Text = _ws.HelloWorld()
End Sub
When the Web site and Web Service application are set to allow only Windows
Authentication, the following code works perfectly when used in a Desktop
application but fails with a 401 (Unathorized) error when used in a Pocket
PC 2003 application.
The same behaviour occurs if the Web site is set to allow Anonymous access
and the Web Service application is set to allow only Windows Authentication.
Imports System.Net
Imports <web reference>
Private Sub CallHelloWorld()
Label1.Text = String.Empty
Label1.Update()
Dim _ws As <web service> = New <web service>
Dim _nwc As NetworkCredential = New NetworkCredential("<user
name>@<domain name>", "<password>")
_ws.Credentials = _cred
_ws.PreAuthenticate = True
Label1.Text = _ws.HelloWorld()
End Sub
When the Web site and Web Service application are set to allow only Basic
Authentication, the following code works perfectly when used in a Desktop
application but fails with a 401 (Unathorized) error when used in a Pocket
PC 2003 application.
The same behaviour occurs if the Web site is set to allow Anonymous access
and the Web Service application is set to allow only Basic Authentication.
Imports System.Net
Imports <web reference>
Private Sub CallHelloWorld()
Label1.Text = String.Empty
Label1.Update()
Dim _ws As <web service> = New <web service>
Dim _nwc As NetworkCredential = New NetworkCredential("<user name>",
"<password>")
_ws.Credentials = _cred
_ws.PreAuthenticate = True
Label1.Text = _ws.HelloWorld()
End Sub
In the latter two examples, the behaviour is the same if the
'_ws.PreAuthenticate = True' line is removed.
In all examples, the behaviour is the same regardless of whether the Web
Service is accessed from the Internet or the LAN.
No proxy servers are involved.
To confuse the whole issue, accessing the Web service and Web method work
perfectly from PocketIE on the Pocket PC both from the LAN and from the
Internet.
I suspect that the use of the NetworkCredential class might be deprecated in
the CompactFramework or that there might be, (god forbid), a 'bug' in the
CompactFramework with the effect being that the details from the
NetWorkCredential object are not passed correctly in the call to the Web
method.
The Web Server is IIS 6.0 running on Windows Server 2003.
The Pocket PC has SP2 of the Compact Framework applied.
Can anyone definitely confirm that this is the case, and, if so, has anyone
come up with a reliable workaround?
access, the following code works perfectly when used in both a Desktop
application and a Pocket PC 2003 application.
Imports System.Net
Imports <web reference>
Private Sub CallHelloWorld()
Label1.Text = String.Empty
Label1.Update()
Dim _ws As <web service> = New <web service>
Label1.Text = _ws.HelloWorld()
End Sub
When the Web site and Web Service application are set to allow only Windows
Authentication, the following code works perfectly when used in a Desktop
application but fails with a 401 (Unathorized) error when used in a Pocket
PC 2003 application.
The same behaviour occurs if the Web site is set to allow Anonymous access
and the Web Service application is set to allow only Windows Authentication.
Imports System.Net
Imports <web reference>
Private Sub CallHelloWorld()
Label1.Text = String.Empty
Label1.Update()
Dim _ws As <web service> = New <web service>
Dim _nwc As NetworkCredential = New NetworkCredential("<user
name>@<domain name>", "<password>")
_ws.Credentials = _cred
_ws.PreAuthenticate = True
Label1.Text = _ws.HelloWorld()
End Sub
When the Web site and Web Service application are set to allow only Basic
Authentication, the following code works perfectly when used in a Desktop
application but fails with a 401 (Unathorized) error when used in a Pocket
PC 2003 application.
The same behaviour occurs if the Web site is set to allow Anonymous access
and the Web Service application is set to allow only Basic Authentication.
Imports System.Net
Imports <web reference>
Private Sub CallHelloWorld()
Label1.Text = String.Empty
Label1.Update()
Dim _ws As <web service> = New <web service>
Dim _nwc As NetworkCredential = New NetworkCredential("<user name>",
"<password>")
_ws.Credentials = _cred
_ws.PreAuthenticate = True
Label1.Text = _ws.HelloWorld()
End Sub
In the latter two examples, the behaviour is the same if the
'_ws.PreAuthenticate = True' line is removed.
In all examples, the behaviour is the same regardless of whether the Web
Service is accessed from the Internet or the LAN.
No proxy servers are involved.
To confuse the whole issue, accessing the Web service and Web method work
perfectly from PocketIE on the Pocket PC both from the LAN and from the
Internet.
I suspect that the use of the NetworkCredential class might be deprecated in
the CompactFramework or that there might be, (god forbid), a 'bug' in the
CompactFramework with the effect being that the details from the
NetWorkCredential object are not passed correctly in the call to the Web
method.
The Web Server is IIS 6.0 running on Windows Server 2003.
The Pocket PC has SP2 of the Compact Framework applied.
Can anyone definitely confirm that this is the case, and, if so, has anyone
come up with a reliable workaround?