ASP.net配置文件和成员 - 自定义提供商还是应该完全我摇我自己?自定义、配置文件、提供商、成员

2023-09-03 17:01:53 作者:一切终是虚幻丶

首先,我知道这个问题可能是边缘重复的这一个,是的,这是一个有点讽刺的是,我要求的东西,我甚回答自己的问题。

first off, I know that this question could be borderline-duplicate to this one, and yes, it is a bit ironic that I am asking a question for something that I even answered myself.

现在,我讲的ASP.net配置文件。我建立使用MVC如果该事项的申请,我相信内置的配置文件提供程序是没有用的。

Now, I am talking about ASP.net Profiles. I am building an application using MVC if that matters, and I believe that the built-in Profile Provider is useless.

所以此刻,我问自己:如果我按照我自己的意见,并编写自定义配置文件提供,或者我应该完全推出自己的个人资料的东西

So at the moment, I am asking myself: Should I follow my own advice and write a Custom Profile Provider, or should I completely roll my own Profile stuff?

一些假设:

我想我的,我决定一个数据库结构的数据 这是一个全新的应用程序,没有传统的数据库结构或用户群,需要加以整合 小用户的中型企业量(最大〜5000个用户) ASP.net MVC,最有可能的Silverlight 2,甚至一些Windows Azure的,但我还是用它进行试验,但绝对.NET 3.5 SP1。 ,并且可能作为主要决策点:不neccessarily使用窗体身份验证,应用程序可能会最终使用Active Directory或OpenID的身份验证

我还需要调查,如果我可以使用ASP.net会员与非标准的认证供应商(OpenID的),因为我认为ASP.net简介才有意义,当我使用ASP.net成员资格,所以我可能会最终结束写了两个自定义成员资格提供程序的OpenID(这基本上只是充当桥梁),和一个自定义配置文件提供。

I still need to investigate if I can use ASP.net Membership with non-standard authentication providers (OpenID), because I think that ASP.net Profiles only make sense when I use ASP.net Membership, so I might eventually end up writing both a custom Membership Provider for OpenID (That essentially just serves as a bridge), and a custom Profile Provider.

所以,是的,我认为这可能是一个好办法,因为我不断用什么框架已经给了我,但我旁边,与成员和配置文件,没有任何经验,所以也许有人在这里有我是否一些见解应该完全推出自己的认证和/或配置文件,或者如果我更好编写自定义成员和资料提供者,这显然是什么那么做?

So yeah, I think that that might be a good way because I continue to use what the framework already gives me, but I have next to no experience with Membership and Profiles, so maybe someone here has some insight whether or not I should completely roll my own Authentication and/or Profiles, or if I am better off writing custom Membership and Profile Providers, which apparently is what SO did?

推荐答案

我没有经历过写我自己的空间提供商,但我已经写我自己的成员提供。这是比较容易的(有很多,你的方法不的需要来实现)。实际上,似乎确实需要的唯一方法是的getUser()和的ValidateUser()方法

I'm not experienced writing my own profile provider, but I have written my own membership provider. It's relatively easy (there are plenty of methods that you don't need to implement). In fact the only methods that seem really required are the GetUser() and ValidateUser() methods.

的唯一部分,这是一个有点棘手(和价值分析)是,它似乎的getUser()被调用pretty的频繁,你应该考虑缓存的结果,这样你不会总是命中数据库。

The only part that's a little tricky (and worth profiling) is that it seems that GetUser() gets called pretty frequently and you should think about caching the results so that you're not always hitting the database.