Re: The server committed a protocol violation



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).

...



.



Relevant Pages

  • Re: HTTP_AUTHORIZATION header
    ... I use WFetch to make a Basic authenticated POST request against my CGI EXE ... Nitpick on your stated understanding of authentication protocols - ... header is not expected for every request for NTLM ...
    (microsoft.public.inetserver.iis.security)
  • Re: HTTP_AUTHORIZATION header
    ... authentication sequence. ... this in your setup by directly accessing the CGI EXE a couple of timems. ... i.e. the HTTP_AUTHORIZATION header gets sent every time ... I use WFetch to make a Basic authenticated POST request against my CGI ...
    (microsoft.public.inetserver.iis.security)
  • RE: HttpWebRequest over Https Via Proxy Fails using NTLM
    ... The proxy authentication header returns Basic, NTLM, and Negotiate. ... A network trace shows that the https request handshake is as follows: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: HTTP_AUTHORIZATION header
    ... HTML file from one virtual directory, and then immediately execute a CGI from ... Authentication happens when I request the HTML ... header is not expected for every request for NTLM ...
    (microsoft.public.inetserver.iis.security)
  • Re: Each HTTP object being requested twice (401 then 200 responses)
    ... Authentication" and the web.config authentication setting is ... Authorized because the request was made anonymously. ... requests the same object a second time it uses kerberos; ... Kerberos and not NTLM, which is good since that's a requirement for ...
    (microsoft.public.inetserver.iis.security)

Loading