views:

247

answers:

1

Hi

I'm doing FormsAuthentivcation, on a Silverlight app. When the SL app calls a WCF service I'm trying to get the authenticated username from within my WCF service like this:

 ServiceSecurityContext.Current.PrimaryIdentity.Name;

or this (unsure of which to use, problem is that both are empty)

ServiceSecurityContext.Anonymous.PrimaryIdentity.Name;

I'm configured the wcf service with a binding like this:

   <basicHttpBinding>
     <binding name="myBinding">
       <security mode="None">
         <message clientCredentialType="UserName"/>
       </security>
     </binding>

Problem is that I'm unable to get the Identity. I'm not setting the Credentials manually in the client. proxy.ClientCredentials.UserName.UserName="slkfslkdf"; (do I have to do that?)

Thanks for any help!

A: 

This is simply solved by HttpContext.Current.User; No need to go into custom headers or the ServiceSecurityContext when doing forms auth.

Larsi