ASP.Net網站管理工具配置

來源:互聯網
上載者:User

標籤:style   http   color   使用   strong   檔案   

筆者想使用ASP.NET Web 應用程式管理工具來添加身分識別驗證。

點擊項目->asp.net配置開啟了ASP.Net網站管理工具頁面:


然後點擊security選項卡,出現如下問題:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. 

The following message may help in diagnosing the problem: Unable to connect to SQL Server database.


筆者用的編程環境是VS2012。

解決方案:

詳細介紹參考《asp.NET 2.0中的登陸控制項簡介 》
其中文中提及到的asp.net Web Site Administration Tool中Security需要一些相關的設定才可以應用,具體設定方法如下:
(Microsoft MSDN:http://forums.microsoft.com/msdn/showpost.aspx?postid=81990&siteid=1&PageID=0

在你的SQL伺服器上建立asp.NET 2.0的應用程式支援資料,需要建立一些表,預設是放在aspnetdb的資料庫裡面。而安裝時並沒有產生aspnetdb資料庫所以出錯。

首先,運行 aspnet_regsql(C:\windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe) 來安裝membership所要建立的資料庫。

在嚮導中選擇SQL驗證,輸入資料庫的使用者名稱、密碼(以前建的)。


然後,修改機器上web.config檔案(C:\windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\web.config)或者是工程的web.config檔案。
要注意<connectionStrings> ... </connectionStrings>這個節

在本工程web.config中添加如下語句:

<connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer"
    connectionString="Data Source=THINK-PC;Initial Catalog=aspnetdb;Persist Security Info=True;User ID=sa;Password=123456"
    providerName="System.Data.SqlClient" />
  </connectionStrings>

成功!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.