401 Authentication fail calling Web Service over SSL from PocketPC with Basic Authentication.

From: John Hynes (john_at_hynes.plus.com)
Date: 09/19/03


Date: Fri, 19 Sep 2003 14:49:49 +0100


Hi,

I'm trying to access a Web Service over SSL from a PocketPC device (iPaq).

The Web service is running on IIS 5.0, with Basic Authentication and Require
SSL enabled.

I can successfully access the web service from the browser - I have to enter
the username/password and OK a message box about the server certificate name
not matching the server name (it does!).

When calling from a pocket PC application, I have created an implementation
of ICertificatePolicy and overridden CheckValidationResult to return true
for my server and avoid "Trust Failure" exceptions.

Now when I call the web service it throws an exception - "401 Authentication
Failure".

If I don't use SSL everything works OK.

Code to access my service is:

                m_nc = new NetworkCredential( strNetUser, strNetPassword,
strDomain );
                m_ms = new MyMobileService.MobileService();
                m_ms.Timeout = 60000;
                m_ms.Url = "https://.....";
                m_ms.Credentials = m_nc.GetCredentials( new Uri(m_ms.Url),
"Basic" );
                m_ms.PreAuthenticate = true;

                m_ms.Login(); // web service call - throws exception

Since I can access the service through a browser I'm guessing the server
setup must be OK, and the code above works fine if i use http rather than
https.

Anyone any ideas what to try?
If you're not familiar with the Compact Framework, CredentialCache is not
supported, Windows Authentication is not supported, and client certificates
are not supported so I have to use basic authentication.

Thanks
John