为网络和WinForms .NET认证 [英] .Net authentication for both web and winforms

查看:113
本文介绍了为网络和WinForms .NET认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET Web应用程序我为使用默认的ASP.NET表单认证的客户端。他们现在要求的作品和Web应用程序桌面(的WinForms)应用程序。我创建了从Web应用程序访问他们想要的数据,并把它放到桌面应用程序的Web服务。这一伟大工程..但需要有基于已存储在asp.net应用程序角色的安全和数据访问的同一水平。

I have an ASP.NET web application I built for a client that uses default the ASP.NET forms authentication. They are now requesting a desktop (WinForms) app that works "with" the web application. I have created the webservices to access the data they want from the web app and put it into the desktop app. That works great.. but there needs to be the same level of security and data access based on roles that is already stored in the asp.net application.

所以,现在是时候做出跨两个应用程序的认证工作。
我想通过提示登录趁asp.net验证当用户第一次打开WinForms应用程序,并调用可能是一个Web服务来验证用户,得到用户的角色,以及个人资料。

So now it's time to make authentication work across both applications. I would like to take advantage of the asp.net authentication by prompting a login when a user first opens the WinForms application and the calls possibly a web service to authenticate the user, get the users role, and profile.

我敢肯定,这已经完成,或询问..我只是没有找到问题/答案在SO。

I'm sure this has done and or asked about.. I'm just not finding the question/answer in SO.

推荐答案

第一:使用WCF为您的Web服务。它比旧的ASMX服务一个更好的框架。

First: Use WCF for your web services. It's a better framework than the old ASMX services.

二:WCF可以利用你的ASP.NET应用程序使用相同RoleProvider和的MembershipProvider类。这是一个简单的配置交换机。用他们两个和Web服务需要相同的凭据作为Web应用程序。

Second: WCF can utilize the same RoleProvider and MembershipProvider classes that your ASP.NET application utilizes. It's a simple configuration switch. Use them both and your web service requires the same credentials as the web application.

和...这是pretty多少呢。

And... that's pretty much it.

有关更多信息,请参见:

For more info, see:

实现角色提供

实现成员资格提供

如何:使用ASP.NET成员提供商

这篇关于为网络和WinForms .NET认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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