Where do these usernames and passwords come from? If your website already implements forms authentication, you can bypass the credential settings yourself and use the forms authentication cookie. If your users are logged in, the cookie will be sent with a web service call. To read it on the other hand, you need to make a couple of changes.
First you need to enable ASP.NET compatibility mode for WCF in the system.ServiceModel section:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
, , , cookie ASP.NET [AspNetCompatibilityRequirements]
[ServiceContract]
[AspNetCompatibilityRequirements(
RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ExampleService
{
}
HttpContext.Current.User.Identity, .
, , PrincipalPermission,
[OperationContract]
[PrincipalPermission(SecurityAction.Demand, Authenticated=true)]
public string Echo()
, ASP.NET, , PrincipalPermission , :
[OperationContract]
[PrincipalPermission(SecurityAction.Demand, Role="Administators")]
public string NukeTheSiteFromOrbit()
Silverlight2.