What is the best way to handle authentication in ASP.NET MVC with a Universe database?

。_饼干妹妹 提交于 2019-12-21 20:36:15

问题


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?

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

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


回答1:


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.

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

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

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.




回答2:


You'll have to create a custom provider for that. It isn't very hard, as long as you can access the web service without an issue.




回答3:


Have you investigated the UniObjects interface? It comes with Universe, but needs to be installed. It has complete access to all database functions. Logging in, Selecting files, reading, writing, deleteing, creating new files etc.



来源:https://stackoverflow.com/questions/71644/what-is-the-best-way-to-handle-authentication-in-asp-net-mvc-with-a-universe-dat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!