通过服务进行ASP.NET成员身份验证 [英] ASP.NET Membership Authentication through Service

查看:109
本文介绍了通过服务进行ASP.NET成员身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:

我想创建一个允许我通过ASP.NET Web应用程序连接到它的Web服务,然后像成员资格提供者/角色提供者一样对用户进行身份验证.

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.

我不想通过在ASP.NET Web应用程序的Web.config中进行配置来使用成员资格/角色提供程序.相反,我想要的是进行某种配置,该配置将我的Asp.net Web应用程序指向一个Web服务(我要创建的Web服务),而不是对用户进行身份验证.

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.

期望的解决方案:

经过一些Google研究,我发现解决方案可能是:WCF身份验证服务.但是我无法使其正常工作.我创建了此服务,按照本文中的说明进行了所有配置:

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

但是我不确定,现在如何配置Asp.Net Web应用程序以将该服务用作成员资格/角色提供程序.

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 ... :)

推荐答案

您正在朝正确的方向前进.

You are going in the right direction.

ClientFormsAuthenticationMembershipProvider 是成员身份您正在寻找的提供者.

ClientFormsAuthenticationMembershipProvider is a membership provider you are looking for.

下面是使用它的示例web.config配置:

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>

配置可能很棘手.我花了几个小时才弄清楚应该添加ClientSettingsProvider.ServiceUri.

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

您可以将临时WinForms或WPF项目添加到解决方案中以构建配置.这些类型的项目在项目设置中具有特殊的选项卡-服务选项卡,这些选项卡提供用于配置的GUI.下面的示例适用于.NET 3.5,但适用于4.0.

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/使用客户端应用程序实施应用程序安全性

这篇关于通过服务进行ASP.NET成员身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆