<authorization> <allow users="Bob" /> <deny users="?"/> </authorization>
string username = "Bob"; string password = "password"; bool bLogin = false; // BasicHttpBinding and endpoint are provided in app.config file. AuthenticationServiceClient authService = new AuthenticationServiceClient(); string customCredential = "Not used by the default membership provider."; // Authentication ticket remains valid across sessions. bool isPersistent = true; bLogin = authService.Login(username, password, customCredential, isPersistent);
protected void Application_Start(object sender, EventArgs e) { System.Web.ApplicationServices.AuthenticationService.Authenticating += new EventHandler<System.Web.ApplicationServices.AuthenticatingEventArgs> (AuthenticationService_Authenticating); } void AuthenticationService_Authenticating(object sender, System.Web.ApplicationServices.AuthenticatingEventArgs e) { if (e.UserName.IndexOf("Bob") >= 0) { e.Authenticated = true; } e.AuthenticationIsComplete = true; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)