G
Guest
My goal is to use Windows Authentication (WA) to access sensitive web
services from a compact framework (CF) application. My web site on the
development server(IIS 6.0) is set to WA. I'm using O'Reilly's "Programming
..NET Web Services" as reference. I have created the web service, tested it
and shown that it works, and configuted its web.config file to to accomodate
WA by adding;
<authentication mode="Windows" />
<identity impersonate="true" />
Of course supplying credentials for the CF app is one of the challenges
since login is not a requirement on a PDA. THe O'Reilly book suggests that
the following code might be used in calling the web service:
mammoth.POE_WebServices wert = new PreProcEval.mammoth.POE_WebServices();
wert.Credentials = new NetworkCredential( "userid", "password", "domain" );
wert.PreAuthenticate = true;
String error = String.Empty;
try
{
DataSet myData = wert.POE_FindPatient( "Z99999", String.Empty,
String.Empty, error );
foreach( DataRow myRow in myData.Tables[0].Rows )
{
lvPatientSelector.Items.Add( new ListViewItem(
myRow.ItemArray[0].ToString() ));
}
}
catch( WebException wex )
{
MessageBox.Show( wex.Status.ToString() );
}
Notice the use of WebClientProtocol.Credentials to supply login in. MS
documentation says that the credentials can be used for "basic, digest, NTLM
and Kerberos authentication mechanisms". I'm assumming that Kerberos is
equivalent to WA, you may disabuse me if I'm wrong. Currently this code is
producing a WebException status of "ProtocolError" defined as "The response
received from the server was complete but indicated a protocol-level error.
For example, an HTTP protocol error such as 401 Access Denied would use this
status." In fact if I dig deeply enough into the WebException in the watch
window I find the 401 status code. Once again, I'm trolling for clues as to
what I'm missing here. (Thanks to Johann Granados for setting me on the
right path with yesterdays problem.)
Bill
services from a compact framework (CF) application. My web site on the
development server(IIS 6.0) is set to WA. I'm using O'Reilly's "Programming
..NET Web Services" as reference. I have created the web service, tested it
and shown that it works, and configuted its web.config file to to accomodate
WA by adding;
<authentication mode="Windows" />
<identity impersonate="true" />
Of course supplying credentials for the CF app is one of the challenges
since login is not a requirement on a PDA. THe O'Reilly book suggests that
the following code might be used in calling the web service:
mammoth.POE_WebServices wert = new PreProcEval.mammoth.POE_WebServices();
wert.Credentials = new NetworkCredential( "userid", "password", "domain" );
wert.PreAuthenticate = true;
String error = String.Empty;
try
{
DataSet myData = wert.POE_FindPatient( "Z99999", String.Empty,
String.Empty, error );
foreach( DataRow myRow in myData.Tables[0].Rows )
{
lvPatientSelector.Items.Add( new ListViewItem(
myRow.ItemArray[0].ToString() ));
}
}
catch( WebException wex )
{
MessageBox.Show( wex.Status.ToString() );
}
Notice the use of WebClientProtocol.Credentials to supply login in. MS
documentation says that the credentials can be used for "basic, digest, NTLM
and Kerberos authentication mechanisms". I'm assumming that Kerberos is
equivalent to WA, you may disabuse me if I'm wrong. Currently this code is
producing a WebException status of "ProtocolError" defined as "The response
received from the server was complete but indicated a protocol-level error.
For example, an HTTP protocol error such as 401 Access Denied would use this
status." In fact if I dig deeply enough into the WebException in the watch
window I find the 401 status code. Once again, I'm trolling for clues as to
what I'm missing here. (Thanks to Johann Granados for setting me on the
right path with yesterdays problem.)
Bill