簡體   English   中英

ASP.NET MVC4是Simplemembership還是autoFormsAuthentication?

[英]ASP.NET MVC4 Simplemembership or autoFormsAuthentication?

我是ASP.NET MVC4的新手,因此閱讀了許多有關如何在Intranet網站上進行身份驗證的內容。

為了改進它,我繼承了這種類型的項目,在快速閱讀源代碼之后,我看到登錄名/密碼以明文形式存儲在SqlServer數據庫中...

因此,我的第一個改進是升級身份驗證過程,以便以正確的方式存儲密碼。

這是我到目前為止所做的,在我的GlobalAsax.cs中添加:

            WebSecurity.InitializeDatabaseConnection(
                      connectionStringName: "AppConnectionString",
                      userTableName: "Employe",
                      userIdColumn: "IDE",
                      userNameColumn: "E_mail",
                      autoCreateTables: true);

以便將“ webpages_ *”表添加到我的數據庫中。

我更改了IIS配置,以停用“ AllowAnonymous”連接並激活“基本身份驗證”。 但是現在我面對Web.config的Forms vs SimpleMembership:

<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="true" />

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="30" />
</authentication>

有人可以清楚地向我解釋每個屬性的用法嗎? 我不明白,因為autoFormsAuthentication設置為false,但是authentication之后才使用它。 什么是enableSimpleMembership

謝謝

很難找到關於該主題的任何信息,但我認為將autoFormsAuthentication設置為true會設置:

<authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="2880" /> </authentication>

如果需要其他參數,則需要顯式使用<authentication mode="Forms">

autoFormsAuthentication將未經授權的用戶重定向到任何控制器。 不僅具有'authorize'屬性。

但這只是我的意見...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM