導航:首頁 > 文件管理 > asp讀取配置文件

asp讀取配置文件

發布時間:2024-04-23 17:39:23

① 請問如何用ASP讀取ini配置文件

不建議這么做。
假設你用scripting.filesystemobject或者adodb.stream組件來讀文件內容
那麼判斷ip 和 name 的值是是要寫很復雜的東西,而且效率也不高。

那麼怎麼解決這個問題呢?
建議你用xml
把system.ini改寫為system.xml

如下:
<system>
<ip name=123 >192.168.0.1</ip>
</system>

通過xmldom的讀數節點,就很容易實現。
'創建DOM對象
set objDom=server.CreateObject("MicroSoft.XMLDom")

'取得XML數據
objDom.load(Server.Mapth("system.xml"))
set objtofind=objdom.documentElement.SelectSingleNode("//system/ip")

'取出這個節點對象的 節點名,節點值,某個屬性值,和全部的XML

nodename=objtofind.nodename
nodevalue=objtofind.text
objtofind.GetAttributeNode("name").NodeValue '屬性名為name的屬性值
'取出一個屬性節點對象

set objattrtofind=objdom.documentElement.SelectSingleNode("//system/ip"). GetAttributeNode("name")

'取出這個節點的屬性名,屬性值
nodeattrname=objattrtofind.nodename
nodeattrvalue=objattrtofind.nodevalue

遍歷這個集合

for each element in objnodes
response.write element.nodename
response.write element.text
next

不管你system下有多少子類,都可以讀出來,你只要按xml格式寫。

② asp.net 讀寫配置文件Web.Config

給你一個例子,你瞧瞧:
<appSettings>
<add key="ConnectionString" value="server=192.168.19.250;database=hrms_test;uid=pmstest;pwd=pmstest" />
<add key="WebObjectPath" value="http://localhost/LMS/Files/" />
<add key="PhysicsObjectPath" value="E:/Files/"/>
<add key="SystemCode" value="12" />
<add key="OrganizationPath" value ="organization" />
</appSettings>
public static string ConnectionString
{
get { return System.Configuration.ConfigurationManager.AppSettings["ConnectionString"].ToString(); }
}

/// <summary>
/// 組織架構資料庫路徑
/// </summary>
public static string OrganizationPath
{
get { return System.Configuration.ConfigurationManager.AppSettings["OrganizationPath"].ToString(); }
}

/// <summary>
/// 系統編碼
/// </summary>
public static string SystemCode
{
get { return System.Configuration.ConfigurationManager.AppSettings["SystemCode"].ToString(); }
}

/// <summary>
/// 物理上傳路徑
/// </summary>
public static string PhysicsObjectPath
{
get { return System.Configuration.ConfigurationManager.AppSettings["PhysicsObjectPath"].ToString(); }
}

/// <summary>
/// 虛擬上傳路徑
/// </summary>
public static string WebObjectPath
{
get { return System.Configuration.ConfigurationManager.AppSettings["WebObjectPath"].ToString(); }
}

③ 在asp.net中的.sln文件是干什麼的怎麼讀懂sln文件中的內容呀

您好,sln:在開發環境中使用的解決方案文件。它將一個或多個項目的所有元素組織到單個的解決方案中。此文件存儲在父項目目錄中.解決方案文件,他是一個或多個.proj(項目)的集合。

一,新建網站是沒有這個sln文件的,如果你想有這個文件就要另存為...,在解決方案資源管理器裡面選中解決方案,然後在VS的文件選項裡面選擇XX.sln另存為...就可以了,winform項目新建就有的,不用另存為
二,這個文件就是解決方案的配置文件,小項目用處不大,主要是大項目...
三,還是因為這個就是解決方案的配置文件,你一雙擊就打開了這個解決方案下的所有項目...(如果你雙擊項目文件就能打開一個項目下的所有文件)。
Solution Explorer points to the CSolution object indicating that it is part of the T:Microsoft.VisualStudio.Shell.Interop.IVsHierarchy.
When the solution is opened in Visual Studio, an entry is made for the solution file (Solution1.sln) in the running document table (RDT). The solution file contains information persisted for the solution which includes Project1 as shown in Solution Explorer. (Information relating to the specific project items and the project itself are contained in Project1's text-based project file. If an element of the project is opened for editing, there is an entry for the project file in the RDT.)
The context menu displayed when the user right-clicks the solution node contains an entry for Solution Notes (not shown in the diagram). From this menu, the user can select either Add New Solution Note or View Solution Notes. Selecting one of these options opens the Solution Notes window. The Solution Notes window contains the following three links:
Note Name—The name of the note. The note can be renamed or deleted in the Solution Notes window by right-clicking the name field, or renamed in theProperties window.
Issue—This field was added programmatically by the implementation in the sample and can be set to TRUE (to indicate that there are issues in the solution that need to be addressed) or False.
Shared—If this field is set to TRUE, the note can be viewed by other users and is stored with the Note Name as a name-value pair in the .sln file. If it is set to false, the note is not shared with other users and the contents of the note are stored with other private user options in the .suo file.
Selecting one of the notes in the Solution Notes window causes the properties for that note to be displayed in the Properties window. The properties shown in the three fields of the Solution Notes window can be changed in the Properties window. In addition to the three fields described above, the Properties window also contains the size of the note consisting of the number of characters in the note.
The class CNoteToolWin implements the Solution Notes window. It is contained within the class CSlnExtPkg that is the class for the Solution Extender Window. When Add New Solution Note or View Solution Notes is selected from the solution menu, a call is made to CSlnExtPkg to open the Solution Notes window.
At the same time, a call is made to CSlnNote. This opens the standard text editor to view the text of the note, or to allow a new note to be written, by calling the CreateDocumentWindow method and passing in the MKDocumentString for the document to be loaded into the window. By specifying theAltDocData flag (CDW_fAltDocData) in this call instead of RDTDocData, you indicate to the environment that you are loading a subset of the RDTDocDatadocument into the text buffer.
This is important because the entry in the RDT is for the entire solution file. If RDTDocData is called, the .sln file is loaded into the editor rather than the subset of the solution that is the note. This results in an error condition because the same document (in this case the solution file) cannot have two entries in the RDT, indicating that the same document was opened in two different editors.

④ 在網上下載了一個ASP源代碼;結果瀏覽時;「配置錯誤 由於許可權不足而無法讀取配置文件」 錯誤代碼0x800700

是文件的許可權問題,給IIS用戶分配讀寫許可權就行了

⑤ ASP.NET載入配置文件時出錯: 對路徑「C:\Inetpub\wwwroot\fann\web.config」的訪問被拒絕。

1。 查看下web.config文件是否為只讀2。設置下IIS許可權,把許可權都打開試一下

⑥ ASP大神,IIS網站錯誤代碼0x80070003無法讀取配置文件怎麼處理

二個問題
1、可能是文件的使用許可權問題,修改文件的是許可權
2、可能是文件的路徑問題,文件的實際路徑與網頁設置的路徑不一致,以致找不到文件

閱讀全文

與asp讀取配置文件相關的資料

熱點內容
網貸上大數據 瀏覽:85
安卓手機電信連網設置 瀏覽:702
大數據可視化報表 瀏覽:78
文件中轉站沒法下載內容 瀏覽:315
js默認圖 瀏覽:486
麗麗要去看電影英漢互一 瀏覽:525
法國啄木鳥在哪裡看 瀏覽:385
iphone4連接顯示器 瀏覽:211
漏器官大尺度電影 瀏覽:909
nba2k14iff文件放哪 瀏覽:829
什麼編程語言大小寫不敏感 瀏覽:859
alias電影 瀏覽:499
反派吞鑽石的電影 瀏覽:598
支持百度網盤下載電影網 瀏覽:478
數據線怎麼打成死結 瀏覽:144
英文生肉網 瀏覽:162
大學怎麼學編程 瀏覽:622
如何用好壓解壓文件 瀏覽:332
如何給文件解密 瀏覽:476
無需下載就可以免費試看的最好的片 瀏覽:234

友情鏈接