ASP.NET串連帶密碼Access的方法

來源:互聯網
上載者:User

雖然Access加上密碼破解起來非常容易,但是出於一些安全性的考慮,還是要做一下的。

1、為Access加上密碼

先開啟 Microsoft Access,選擇“檔案-開啟”,選擇好要加密的mdb資料庫檔案,展開“開啟”按鈕(注意:按鈕旁邊有一個下拉的選項),並選擇“以獨佔方式開啟”。開啟mdb資料庫檔案以後(這裡我開啟的是weste_net.mdb資料庫),選擇“工具-安全-設定資料庫密碼”,在“密碼”和“驗證”文字框中輸入相同的密碼,關閉資料庫即可。

2、相應的連接字串

在Web.config加入

<appSettings> <add key="oleDSN" value="Provider=Microsoft.Jet.OLEDB.4.0;Data source="/> <add key="oleFile" value="~/DataBase/weste_net.mdb;" /></appSettings>

在相應串連處這樣寫

string strConn = ConfigurationSettings.AppSettings["oleDSN"]+Server.MapPath(ConfigurationSettings.AppSettings["oleFile"].Trim())+"Jet OLEDB:Database Password=123456";//Database Password就是設定好的密碼
OleDbConnection conn = new OleDbConnection(strConn);

這樣就可以了。

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\bin\Debug\DB.mdb;Persist Security Info=True;Jet OLEDB:Database Password=10

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=""D:\aa.mdb"";Jet OLEDB:Database Password=1";

==============

//以下是解決方案--------------------------------
1.進入DOS命令列
2.cd \
3.cd c:\windows\microsoft.net\framework\v2.0.50727
4.然後執行命令 aspnet_regiis -ga administrator //註:administrator為當前登入使用者名稱
5.aspnet_regiis -i -enable
6.net stop iisadmin
7.net start w3svc
//對了說一下,aspnet_regiis.exe這個程式是在c:\windows\microsoft.net\framework\v2.0.50727目錄下的,如果你的不是windows xp sp2,那麼請您搜尋該程式,只要執行相同的命令即可.

 

導致錯誤的原因:

先裝visual studio 2005後裝IIS,導致asp.net沒有註冊成功。

=================

訪問asp.net頁面時Server Application Unavailable 當您嘗試查看 ASP.NET 應用程式中的頁面時,可能會收到以下錯誤資訊:

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable.Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note:An error message detailing the cause of this specific request failure can be found in the system event log of the web server.Please review this log entry to discover what caused this error to occur.

還會在應用程式事件記錄檔中顯示以下錯誤資訊:

aspnet_wp.exe could not be started.HRESULT for the failure:80070005

事件類型: 錯誤
事件來源: ASP.NET 1.1.4322.0
事件種類: 無
事件 ID: 1084
日期:  2005-12-10
事件:  0:00:44
使用者:  N/A
電腦: NHUCC1
描述:
aspnet_wp.exe could not be started. The error code for the failure is 80070545. This error can be caused when the worker process account has insufficient rights to read the .NET Framework files. Please ensure that the .NET Framework is correctly installed and that the ACLs on the installation directory allow access to the configured account. 原因出現此問題的原因是進程模型使用者帳戶(預設情況下為 ASPNET)沒有所需系統檔案和檔案夾的正確使用者權限,以便運行 ASP.NET 背景工作處理序。

替代方法要解決此問題,請驗證該 ASPNET 帳戶擁有如下所示的正確使用者權限:

%windir%\Microsoft.NET\Framework\Version\Temporary ASP.NET 檔案:完全控制
%windir%\Temp:完全控制
應用程式檔案夾:讀取
%installroot% 階層(例如,%windir%\Microsoft.Net\Framework\Version):讀取
%windir%\Assembly:讀取

注意:這是全域組件快取。不能直接使用 Windows 資源管理員編輯此檔案夾的 ACL。正確做法是,開啟命令視窗,然後運行以下命令:

cacls %windir%\assembly /e /t /p domain\useraccount:R

另外,在使用 Windows 資源管理員之前,請先運行以下命令以取消對 Shfusion.dll 的註冊:

regsvr32–u shfusion.dll

在 Windows 資源管理員中設定了使用者權限後,請運行以下命令重新註冊 Shfusion.dll:

regsvr32 shfusion.dll
網站根目錄(例如,%root%\Inetpub\Wwwroot)或預設網站指向的路徑:讀取
%windir%\System32:讀取
(通常情況下,ASPNET 帳戶已被授予了使用者群組成員的使用者權限。)

狀態請定期更改 ASPNET 帳戶的密碼。每次安裝產品時會重新為 ASPNET 帳戶設定密碼。 這種現象是設計導致的。
==============
替換:模板中的空格和斷行符號符
dd.Replace("\r\n", "<br>").Replace(" ", "&nbsp;");
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.