// Enabling the authentication service, all other WCF services in your web application will have to compatible with ASP.NET // http://msdn.microsoft.com/en-us/library/aa702682.aspx [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class PrimeService : IPrimeService { public int NextPrime(int n) { // HttpContext.Current.User.Identity.IsAuthenticated is true because // Application_AuthenticateRequest set the authenticated user into the context if (!HttpContext.Current.User.Identity.IsAuthenticated) { throw new FaultException(new SecurityAccessDeniedException()); } // calculate prime number } }