Re: The server committed a protocol violation
- From: "John S." <john.spraul@xxxxxxxxxxxxxxxxxx>
- Date: 24 Oct 2006 13:13:40 -0700
Rather than relying on connection & authentication pooling to work
(because it doesn't for SSL, and only when requested for NTLM
[.UnsafeAuthenticatedConnectionSharing = true]), it's simplest to add
the authentication header manually. The example above demonstrates how
to do so for regular web requests. For soap clients, you'll need to add
an override to the GetWebRequest() method which adds the header there.
Still haven't looked at NTLM though.
protected override WebRequest GetWebRequest(Uri uri)
{
string user = "user";
string password = "password";
WebRequest request = base.GetWebRequest(uri);
request.Headers.Add(String.Format("Authorization: Basic {0}",
Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(
String.Format("{0}:{1}", user, password)))));
return request;
}
John S. wrote:
...
Basically, always ensure a standard web request has been made to the
device prior to making a SOAP call. When making the standard request,
be sure to manually add the Authorization header (only demonstrated for
Basic authentication below -- good luck with NTLM!). Be sure to set the
SoapServer's .PreAuthenticate property = true. The connection will be
re-used and the authentication will be sent properly.
The following work-around or some other accomplishing the same purpose
will be required to use .NET 2.0 HTTP/Soap helper classes to access
Windows CE-powered device web sites that require authentication (sorry
for the fomatting).
...
.
- Follow-Ups:
- Re: The server committed a protocol violation
- From: John Spaith [MS]
- Re: The server committed a protocol violation
- References:
- The server committed a protocol violation
- From: John S.
- The server committed a protocol violation
- Prev by Date: Re: SDIO performance on WinCE5.0/6.0
- Next by Date: Re: User can't connect WM5 device
- Previous by thread: The server committed a protocol violation
- Next by thread: Re: The server committed a protocol violation
- Index(es):
Relevant Pages
|