什么是处理身份验证在ASP.NET MVC与宇宙数据库的最佳方式? [英] What is the best way to handle authentication in ASP.NET MVC with a Universe database?

查看:118
本文介绍了什么是处理身份验证在ASP.NET MVC与宇宙数据库的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用一个被称为宇宙的IBM数据库保存我们所有的用户ID,密码和个人资料信息在一个名为USERINFO表。

We use an IBM database known as Universe that holds all of our user id's, passwords, and profile information in a table called USERINFO.

我可以使用会员提供连接到该数据库,并验证用户?

Can I use the Membership Provider to connect to this database and authenticate the user?

数据库访问实际上是通过一个Web服务,因为我们没有直接连接到数据库。

The database access is actually through a web service since we don't have a direct connect to the database.

我们有一个叫GetUserInfo一个Web服务方法,它接受用户名的参数。该方法将返回密码和配置文件信息。

We have a web service method called GetUserInfo which accepts a parameter of username. The method will return the password and profile information.

推荐答案

正如上面提到的,你需要创建一个自定义成员资格提供其中相当简单。您可以创建一个从System.Web.Security.MembershipProvider继承.NET类。有迹象表明,需要在你的类被覆盖的几种方法,但大多数都甚至没有得到MVC账户控制器使用。你想覆盖的主要方法是的ValidateUser这将让用户登录(用户名,密码)。你实现类之后,你需要在web.config中这是很容易,以及进行注册。

As mentioned above, you'll need to create a custom membership provider which a fairly straightforward. You'll create a .NET class that inherits from System.Web.Security.MembershipProvider. There are several methods that need to be overriden in your class, but most are not even used by the MVC account controller. The main method you'll want to override is ValidateUser(username, password) which will get a user logged in. After you've implemented your class you'll need to register it in web.config which is easy as well.

您可以从这里找到一个自定义的提供程序的示例:
<一href=\"http://msdn.microsoft.com/en-us/library/6tc47t75(VS.80).aspx\">http://msdn.microsoft.com/en-us/library/6tc47t75(VS.80).aspx

You can find a sample for a custom provider here: http://msdn.microsoft.com/en-us/library/6tc47t75(VS.80).aspx

和这里的整个过程的教程:
http://www.15seconds.com/issue/050216.htm

And a tutorial for the entire process here: http://www.15seconds.com/issue/050216.htm

请即作出了MVC自定义提供程序的过程是一个标准的ASP.NET web站点相同,但是MVC没有充分利用的MembershipProvider类的所有方法,所以它更容易实现。

Keep in mind that the process for making a custom provider for MVC is the same for a standard ASP.NET web site, however MVC does not fully utilize all methods of the MembershipProvider class so it's much easier to implement.

这篇关于什么是处理身份验证在ASP.NET MVC与宇宙数据库的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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