Using ASP.net credentials to log in from a WinForms application
We have an ASP.net application but some screens are deemed too slow to use by our users. As a result, we are trying to provide a WinForms-based alternative to those data-input centric screens开发者_如何学C so we can use richer controls like Grids with immediate screen updates and feedback for the user.
Ideally, I would like the users to login to the WinForms application using the same credentials they use in the ASP.net application?
Is it possible? I've found this post ( .Net authentication for both web and winforms ) but it isn't really answering the question from my point of view... We are not using WebServices, or WCF at the moment and do not plan to use it unless it is really the only way to achieve this.
Thanks a lot.
Sure you can, just add the same settings in your app.config that you have in your web.config to wire up the Membership provider, and reference System.Web.Security. Then you can use Membership and Roles from your WinForms application.
See this article for a good example of how to do this: http://www.theproblemsolver.nl/usingthemembershipproviderinwinforms.htm
Take a look at this article: Unify Windows Forms and ASP.NET Providers for Credentials Management.
For even more information check out the links from this answer: http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/9e5192f4-4f44-4db6-aab8-8e79f2e667f8.
精彩评论