I've created a Silverlight 4 app which is hosted in a DMZ away from the client's network - the client opens the application without authentication over SSL, then the app attempts to connect to a WCF service using basic authentication
When the app attempts to hit the WCF service, I get a login prompt - this is expected, but is there any way to send the authentication credentials from the SL app instead, thus avoiding the need for the IE popup?
i.e. can basic authentication to a webservice work from within the SL app, and how do I do it. I'm currently looking through the CSLA src, but I'm not great with webservices
Figured it out - I'm using the CompressedProxy class from Rockys demos - I just overrode the GetProxy method and added the following code which adds the username/password to the header of the request - works like a charm!
WcfPortalClient proxy = base.GetProxy();
var creds = "Basic " + Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(UserName + ":" + Password));
var contextScope = new OperationContextScope(proxy.InnerChannel);
var httpProps = new HttpRequestMessageProperty();
httpProps.Headers[HttpRequestHeader.Authorization] = creds;
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpProps;
Nice solution, thanks for sharing!
Only problem I've got now is that incorrect auth details still cause an IE popup as the app isn't handling the service response - if I figure that out, I'll drop the details here
Copyright (c) Marimer LLC