导航:首页 > 文件管理 > 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读取配置文件相关的资料

热点内容
许君聪二龙湖浩哥的电影 浏览:510
骑士助手文件夹的名字 浏览:825
风云雄霸天下小说全集txt下载 浏览:532
审计大数据情况 浏览:862
随着网络技术迅猛发展对 浏览:737
韩国十大神级电影网站 浏览:878
平板电脑虚拟按键配置文件 浏览:374
欧美动作爱情 浏览:915
word2013更改图片 浏览:980
win10plsql 浏览:819
香港电影开头一个女的在床上自慰 浏览:512
win10cdromsys下载 浏览:30
桌面程序hibernate 浏览:14
如何建蔬菜网站 浏览:579
android网络通信聊天 浏览:1
电影头上裹着布还有纽扣 浏览:246
iphone6nfc充电 浏览:422
铁锈战争的文件夹是哪个 浏览:184
大数据业务描述 浏览:162

友情链接