我尝试了很多在ASP.NET MVC中实现自定义配置文件提供程序.我已经阅读了很多很多教程,但我无法找到问题所在.它与ASP.NET MVC中的实现配置文件提供程序非常相似.
但是我想创建自己的Profile Provider,所以我编写了以下继承自的类ProfileProvider:
public class UserProfileProvider : ProfileProvider
{
#region Variables
public override string ApplicationName { get; set; }
public string ConnectionString { get; set; }
public string UpdateProcedure { get; set; }
public string GetProcedure { get; set; }
#endregion
#region Methods
public UserProfileProvider()
{ }
internal static string GetConnectionString(string specifiedConnectionString)
{
if (String.IsNullOrEmpty(specifiedConnectionString))
return null;
// Check <connectionStrings> config section for this connection string
ConnectionStringSettings connObj = ConfigurationManager.ConnectionStrings[specifiedConnectionString];
if (connObj != null) …Run Code Online (Sandbox Code Playgroud) 我目前正在使用ActiveDirectoryMembershipProvider仅用于在asp.net内置的内部业务应用程序进行身份验证.这就像一个魅力.
我现在希望添加一些功能来处理用户的自定义配置文件信息,理想情况下也存储在Active Directory中.
举一个简单的例子,我们只说自定义属性是FavoriteColor.然后我的目标是让我的应用程序能够为经过身份验证的用户读取此自定义属性.
我已经看了一下ADAM.对于角色提供者来说,这看起来很棒,但我还没有找到任何表明它适用于Profile Provider的东西,或者它甚至可以让我存储像FavoriteColor这样的自定义属性.也许有人知道更好?
我也是Active Directory的新手,所以也许甚至可以选择在其中存储自定义用户属性(如FavoriteColor)?
总的来说,我只是在寻找有关实施此方法的最佳方法的想法?
谢谢!
我正在冒险进入asp.net mvc的世界.我还没有理解使用自定义成员资格提供程序或使用配置文件提供程序进行用户管理是否有意义?
我知道网站上已有一些关于此主题的问题......
我只是想了解使用ASP.NET Profile Provider与一个流量巨大的网站是否安全?
我看待它的方式,它的布局效率低下.您存储属性名称(这是一个字符串)和属性值(也是一个字符串).如果您只是想在配置文件中存储甚至年龄,则不必要地将字符串"age"一遍又一遍地存储在数据库中,而使用自创建的表,您只需添加一个标题为age的列,而不是冗余?
(我只是想确保我不会错过任何关于它的东西,因为我对它很新.)