MVC3 - 验证与SQL Server的帐户 [英] MVC3 - Authenticate with SQL Server Accounts

查看:139
本文介绍了MVC3 - 验证与SQL Server的帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到任何解决这个问题有用,我从来没有在一个Web应用程序之前使用的认证。所以任何有/无饼干是新的我。

I couldn't find anything useful to this problem and I never used authentication in a web application before. So anything with / without cookies is new for me.

我们已经有了使用SQL Server帐户进行身份验证现有的(非基于web)程序。现在,我想做同样与我MVC3的项目。

We've got an existing (non-web-)program using SQL Server accounts for authentication. Now, I want to do the same with my MVC3 project.

每个用户都有数据库内相同的权利。 (非web的)程序处理的权利本身。在成功的日志记录(与SQL帐户)后,登录名被映射到从中可以得到用户ID和处理的权利管理数据库中的一个实体。如果用户admin登录,他得到ID 4711,将看到更多的输入字段等,而其他用户有较少的权利。

Every user has the same rights inside the database. The (non-web-)program handles the rights itself. After logging in successful (with an SQL account), the login name is mapped to an entity in the database from which one can get the users ID and handle the right management. If the user "admin" is logged in, he gets the ID 4711 and will see some more input fields etc. while other users have less rights.

这可能吗?

除此之外:什么是存储身份验证以及如何最好的办法

Besides that: What's the best approach to store the authentication and how?

先谢谢了。

推荐答案

如果您的数据库结构已经决定了,你可以写自己的MembershipProvider访问数据库(见的 http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx 和的 HTTP://www.$c$cproject.com/KB/aspnet/WSSecurityProvider.aspx

If your DB structure is already decided on, you can write your own MembershipProvider that accesses your database (see http://msdn.microsoft.com/en-us/library/f1kyba5e.aspx and http://www.codeproject.com/KB/aspnet/WSSecurityProvider.aspx).

如果你是灵活的DB结构,可以使用ASP.NET的内置的SqlMembershipProvider(见<一href=\"http://$c$chighstreet.com/Articles/overview_of_membership_and_installing_sql_membership_provider-part_1/overview_of_membership_and_installing_sql_membership_provider-part_1.aspx\" rel=\"nofollow\">http://$c$chighstreet.com/Articles/overview_of_membership_and_installing_sql_membership_provider-part_1/overview_of_membership_and_installing_sql_membership_provider-part_1.aspx).然后,您必须运行为您创建表和索引的SQL脚本。这在MVC 3。

If you are flexible on the DB structure, you can use ASP.NET's built-in SqlMembershipProvider (see http://codehighstreet.com/Articles/overview_of_membership_and_installing_sql_membership_provider-part_1/overview_of_membership_and_installing_sql_membership_provider-part_1.aspx). You then have to run a SQL script that creates the tables and indexes for you. This works in MVC 3.

这篇关于MVC3 - 验证与SQL Server的帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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