亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      考試首頁(yè) | 考試用書(shū) | 培訓(xùn)課程 | 模擬考場(chǎng) | 考試論壇  
        當(dāng)前位置:編程開(kāi)發(fā) > DotNET > ASP.Net > 文章內(nèi)容
        

      ASP.NETWebPages參考手冊(cè):初始化WebSecurity數(shù)據(jù)庫(kù)

       [ 2016年4月28日 ] 【

      初始化 WebSecurity 數(shù)據(jù)庫(kù)

      在代碼中使用 WebSecurity 對(duì)象之前,必須創(chuàng)建或初始化 WebSecurity 數(shù)據(jù)庫(kù)。

      在 web 更目錄中,創(chuàng)建或編輯 _AppStart.cshtml 頁(yè)面。

      在該文件中寫(xiě)入以下代碼:

      _AppStart.cshtml

      @{
      WebSecurity.InitializeDatabaseConnection("Users", "UserProfile", "UserId", "Email", 
      true);
      }
      

      網(wǎng)站每次啟動(dòng)時(shí)都會(huì)運(yùn)行以上代碼。它會(huì)對(duì) WebSecurity 數(shù)據(jù)庫(kù)進(jìn)行初始化。

      "Users" 是 WebSecurity 數(shù)據(jù)庫(kù)的名稱。(Users.sdf)

      "UserProfile" 是包含用戶配置信息的數(shù)據(jù)庫(kù)表的名稱。

      "UserId" 包含用戶 ID 的列的名稱(主鍵)。

      "Email" 是包含用戶名稱的列名。

      最后一個(gè)參數(shù) true 是一個(gè)邏輯值,指示應(yīng)創(chuàng)建用戶配置文件表和成員資格表(如果它們不存在),否則 false。

      提示:盡管 true 指示自動(dòng)創(chuàng)建數(shù)據(jù)庫(kù)表,但數(shù)據(jù)庫(kù)本身不會(huì)被自動(dòng)創(chuàng)建。它必須存在。

      將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動(dòng)訪問(wèn)考試網(wǎng) | 復(fù)制本頁(yè)地址,傳給QQ/MSN上的好友 | 申請(qǐng)鏈接 | 意見(jiàn)留言 TOP
      關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
      Copyright © 2007-2013 中華考試網(wǎng)(Examw.com) All Rights Reserved