【问题标题】:SimpleMembership confusion: InitializeDatabaseFile is not a member of WebMatrix.WebData.WebSecuritySimpleMembership 混淆:InitializeDatabaseFile 不是 WebMatrix.WebData.WebSecurity 的成员
【发布时间】:2013-04-16 14:36:07
【问题描述】:

此方法是否已被弃用?在任何文档中都找不到任何信息。

这是我最初找到代码的地方:

http://blog.osbornm.com/2010/07/21/using-simplemembership-with-asp.net-webpages/

http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx

//Set up Simple Membership
WebSecurity.InitializeDatabaseFile(“SecurityDemo.sdf”, “Users”, “UserID”, “Username”, true);

在我看来它已经被这个方法取代了?

http://msdn.microsoft.com/en-us/library/gg569134(v=vs.111).aspx

这些方法是否完全相同,只是更改了名称?

【问题讨论】:

    标签: asp.net simplemembership


    【解决方案1】:

    是的,InitializeDatabaseFile 已为 InitializeDatabaseConnection 折旧。主要区别在于 depreciated 方法采用数据库名称(在此示例中为 MS SQL Server Compact Edition 数据库),而新方法采用在 web.config 中定义的数据库连接字符串的名称。它不仅限于精简版。您可以在此article on customizing and seeding SimpleMembership 中了解有关初始化 SimpleMembership 的更多信息。

    【讨论】:

    • 好文章。你知道它为什么以及何时被弃用吗?是否有包含更多信息的文档或链接?
    • 不确定什么时候折旧。您引用的文章现在大约有3年了。如果我要推测它为什么被贬值,那是因为用连接字符串定义数据库连接要强大得多。我不确定您要查找的具体文档。如果您只想要有关 WebSecurity 的规范,您可以在此处找到它。 msdn.microsoft.com/en-us/library/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-04-28
    • 2014-11-20
    • 1970-01-01
    • 2015-02-26
    • 1970-01-01
    • 2023-03-05
    • 2013-03-06
    相关资源
    最近更新 更多