3

Objective:

I want to create a web service that allows me to connect to it (through ASP.NET Web Application) and then authenticate users just as Membership Provider Does/Role Provider Does.

I do not want to use Membership/Role Provider by configuring at the ASP.NET Web Application's Web.config. Instead, what i would like, is to have some sort of configuration that points my Asp.net Web Application to a webservice (the one i want to create), that than authenticates the user.

Expected Solution:

what i found after some google research, that the solution might be: WCF Authentication Service. But I am unable to get it working. I created this service, did all the configuration as it says in this article:

http://msdn.microsoft.com/en-us/library/bb398990.aspx

but i am not sure, how do i now configure my Asp.Net Web Application, to use this service as the Membership/Role Provider.

I may be going in complete wrong direction, and this service may not be the solution to my problem. Can you please help me out.

Thanks, Your Dev Brother ... :)

M. Ali Iftikhar
  • 3,125
  • 2
  • 26
  • 36

1 Answers1

2

You are going in the right direction.

ClientFormsAuthenticationMembershipProvider is a membership provider you are looking for.

Below is sample web.config configuration to use it:

<appSettings>
  <add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>

<system.web>
  <compilation debug="true" targetFramework="4.0" />

  <membership defaultProvider="ClientAuthenticationMembershipProvider">
    <providers>
      <clear/>
      <add name="ClientAuthenticationMembershipProvider"
    type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    serviceUri="http://localhost:49712/Authentication_JSON_AppService.axd" />
    </providers>
  </membership>
</system.web>

Configuration may be tricky. I spent hours before figure out that ClientSettingsProvider.ServiceUri should be added.

You may add temp WinForms or WPF project to your solution to build configuration. these types of projects have special tab - Services tab in project settings that provide GUI for configuration. Sample below is for .NET 3.5 but idea is the same for 4.0.

http://www.codeproject.com/Articles/27670/Implementing-Application-Security-with-Client-Appl

Dmitry Harnitski
  • 5,838
  • 1
  • 28
  • 43