Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This is a very reasonable approach. </p> <p>To do this you setup your service endpoint and configure it with your custom membership provider (You can do the same with SQL membership provider, it doesn't require a custom one).</p> <p>On the web application you set up the Authenticate event of the Login control to instantiate a new service proxy and set the username/password in the ClientCredentials in the proxy.</p> <p>Now when you make the call to the Service through the proxy WCF will pass these credentials through the secure channel to the service and use them for authentication.</p> <p>Now you simply need to store the proxy in session and use it for future access to the service as it has the channel state and a private key.</p> <pre><code>protected void LoginControl_Authenticate(object sender, AuthenticateEventArgs e) { bool Authenticated = false; try { MyServiceClient proxy = new MyServiceClient("MyServiceEndpoint"); proxy.ClientCredentials.UserName.UserName = LoginControl.UserName; proxy.ClientCredentials.UserName.Password = LoginControl.Password; //It doesn't really matter what is called or what it does because //Membership Provider for the Service does the authentication. string retval = proxy.login("Logging in"); //Now that channel is established the proxy needs to be kept //since it contains the channel state which includes a private key Session["MyServiceProxy"] = proxy; Authenticated = true; } catch (Exception ex) { //Login Error... } e.Authenticated = Authenticated; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload