Multimobile Development: Building Applications for any Smartphone
PreAuthenticate HttpChannel Connection?
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.


Michael G.
I have this bit of code which works for my Remoting client. The server is
hosted in IIS and requires authentication.
IDictionary Props = new Hashtable();

Props.Add("useDefaultCredentials", true);

BinaryClientFormatterSinkProvider clientFormatter = new
BinaryClientFormatterSinkProvider();

BinaryServerFormatterSinkProvider serverFormatter = new
BinaryServerFormatterSinkProvider();

HttpChannel channel = new HttpChannel(Props, clientFormatter,
serverFormatter);

ChannelServices.RegisterChannel(channel);

I want to make 2 changes.

1) I want all connection through my HttpChannel to PRE-Authenticate.
According to the IIS logs, every request is done in pairs: once without the
authentication (server returns 401), then again with authentication. I need
this to work for both Well Known Objects and Client Activated Objects.

2) I'd like to pass other authentication information in case the default
credentials are no good.

Ideas?

TIA

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
Michael G.
I figured out the second part - I can now specify other credentials than the
defaults. To do this, I implemented a customer Channel Sink Provider and
dynamically updated the credentials property of the transport sink (the last
in the chain) to
new NetworkCredential(<username>, <password>, <domain>).
Works great.

However, even though the properties on the transport sink already include
"preauthenticate" = false, when I set it to true, it doesn't work -- all
calls over the channel are done in pairs - once without the authentication
information, then once with. Did MS forget to implement support for that
property?

Ideas?

Michael G.

"Michael G." <Click here to reveal e-mail address> wrote in message
news:uSpjIx7DCHA.1696@tkmsftngp05...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
    
Greg Reinacker
Are you using Integrated Windows Authentication? You can't avoid multiple
round-trips with this. If you're using Basic or Digest, you can limit
round-trips with the PreAuthenticate property.

--
Greg Reinacker
Reinacker & Associates, Inc.
http://www.rassoc.com
http://www.rassoc.com/gregr/weblog/

"Michael G." <Click here to reveal e-mail address> wrote in message
news:uS5k4$BECHA.2540@tkmsftngp05...
> I figured out the second part - I can now specify other credentials than
the
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
 
 
System.Collections.Hashtable
System.Collections.IDictionary
System.Net.NetworkCredential
System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider
System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider
System.Runtime.Remoting.Channels.ChannelServices
System.Runtime.Remoting.Channels.Http.HttpChannel




Multimobile Development: Building Applications for any Smartphone
Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734