Re: The server committed a protocol violation
- From: "John Spaith [MS]" <jspaith@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 Oct 2006 17:30:39 -0700
Thank you for bringing this up again and even offering suggestions. I
investigated this further and it turns out that the desktop .Netv2 framework
(wrongly) rejected the CE Web Server's access denied error because it came
across on 2 TCP packets, rather than one. For WinCE 6.0, I've changed Web
Server to return the error in one packet in order to make this problem not
get hit.
For previous versions of WinCE, I believe that if you "link" to the NetV1
versions of the managed assemblies that do the Web stuff then everything
will work. That's why this only reproed when building with VS2005 & not
VS2003. That would be a safer fix I think than having to write workaround
code. If you want to try this out (and set my terminology straight on
managed code, I'm really behind the times) I would put additional info in
the netblog and give JohnS (you, not me :)) credit.
--
John Spaith
Development Lead, Windows CE
Microsoft Corporation
Check out the CE Networking Team Blog at http://blogs.msdn.com/cenet/.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2006 Microsoft Corporation. All rights
reserved.
"John S." <john.spraul@xxxxxxxxxxxxxxxxxx> wrote in message
news:1161720820.610415.100830@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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).
...
.
- References:
- The server committed a protocol violation
- From: John S.
- Re: The server committed a protocol violation
- From: John S.
- The server committed a protocol violation
- Prev by Date: Re: Internet Explorer in WIN CE
- Next by Date: Re: Windows CE programming
- Previous by thread: Re: The server committed a protocol violation
- Next by thread: Windows CE and Windows Mobile
- Index(es):
Relevant Pages
|
Loading