什么是使用asp.net成员的优点和缺点? [英] What are the pros and cons using the asp.net membership?

查看:165
本文介绍了什么是使用asp.net成员的优点和缺点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个新的网站和一个朋友建议我使用了认证过程的asp.net会员(登录,注册,密码恢复等)。

I'm building a new website and a friend suggest to me to use the asp.net membership for the authentication process (login, registration, password recovery, etc..).

我看到一切都存储在XML文件中。

I saw that everything is stored in an XML file.

我想知道什么是使用成员,而不是从头开始建立一些利弊。

I would like to know what are the pros and cons using the membership instead of to build something from scratch.

推荐答案

在MS登录解决方案由几部分组成。

The MS login solution consists of several parts.

表单验证 - 这基本上创建了一个安全的饼干,上面写着我验证!在每次请求。没有这一点,用户必须登录每一个网页。

Forms Authentication - This basically creates a secure cookie that says "I'm authenticated!" on every request. Without this, users would have to log in every single page.


  • 优点:这非常适用

  • 缺点:无 - 使用它

会员 - 这是你如何存储你的用户和他们的密码和验证用户凭据。有几种方法可以解决这个:

Membership - This is how you store your users and their passwords, and validate user credentials. There are several ways to approach this:


  1. 使用的SqlMembershipProvider 的 - 微软给你一个数据库存储的用户名/密码牢,并为您提供一种方式来验证凭据。

    • 优点:

      • 少/没有自定义code来维持。作品开箱即用

      • 工程与成员控制和API

  1. Using the SqlMembershipProvider - Microsoft gives you a database to store users/passwords in securely, and gives you a way to authenticate credentials.
    • Pros:
      • Less/no custom code to maintain. Works "out of the box"
      • Works with Membership controls and API

  • 您必须使用SQL Server和使用自己的数据库模式。 (不是问题IMO)

  • 在密码是如何产生的最初没有控制权。他们是长期的和丑陋

  • 当你熟悉的技术陡峭的学习曲线

创建自定义的MembershipProvider 的 - 你可以从继承的MembershipProvider自定义在哪里以及如何存储你的数据

Creating a custom MembershipProvider - You can inherit from MembershipProvider to customize where and how you store your data.


  • 优点:

    • 您免费获得
    • 加密/密码解密
    • 在您存储您的用户控制哪些数据的模样

    • 您仍然可以使用成员控制和API

    • Pros:
      • You get Encryption/Decryption of passwords for free
      • Control over where you store your users and what the data looks like
      • You can still use the Membership controls and API

      • 有实现自己的存储解决方案

      • 您必须编写,调试和维护大量的定制code

      • 如果您添加额外的功能,你必须投提供商使用它

      创建自己的身份验证方案

      Creating your own Authentication scheme


      • 优点:完全控制

      • 缺点:

        • 您创造一切,但调试/维护一切。

        • 您有超过凭据来控制自己的安全。

        • 不能使用成员控制(这不是一个很大的损失,所以控件是pretty简单复制)

        • 不能使用成员身份API

        角色 - 角色控制哪些用户可以通过在web.config中提供的授权机制做,并还与站点地图安全修整。

        Authorization - "What can the users do?"

        Roles - Roles control what the users can do via the authorization mechanism provided by the web.config and also works with security trimming on the sitemap.


        1. 使用SqlRoleProvider 的 - 微软给你一个数据库来存储角色

        1. Using the SqlRoleProvider - Microsoft gives you a database to store roles


        • 优点:

          • 在web.config中
          • 工作
          • 您可以分配多个角色给用户


          • 角色是只是一个字符串,不支持的权限等级。这可以使它难以创建围绕该用户可编辑的其他用户的规则。

          创建自定义RoleProvider 的 - 你可以从RoleProvider继承自定义在哪里以及如何存储你的数据

          Creating a custom RoleProvider - You can inherit from RoleProvider to customize where and how you store your data.


          • 优点:与web.config中工作

          • 缺点:

            • 有实现自己的存储解决方案

            • 仍然只是一个字符串,如限制为previous解决方案

            • 如果你没有正确地执行它,它可以做很多的数据库调用。

            创建自己的身份验证方案

            Creating your own Authentication scheme


            • 优点:完全控制 - 还是做你的网页和错误的定制检查/重定向必要

            • 缺点:

              • 不与web.config中/站点地图提供的授权机制的工作。实际上,这意味着增加一个页面到一个文件夹(如/管理员)不再保证网页的安全性。

              要注意的是,成员资格和角色提供者可以选择或彼此独立的定制是很重要的。我个人推荐使用的SqlMembershipProvider如果你能和你的评估选项的角色提供。


              It's important to note that the Membership and Role providers can be chosen or customized independently of each other. I would personally recommend using the SqlMembershipProvider if you can and evaluating your options for the Role Provider.

              这篇关于什么是使用asp.net成员的优点和缺点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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