如何:创建 Web.config 文件
2006-11-16 17:00
477 查看
Web.config 文件的创建,“添加新项”
键入小于号 (<) 开始一个新元素。
出现一个下拉列表,该列表提供可在此插入点添加的有效元素。或者,也可以按“Ctrl+J”显示该下拉列表而无需键入小于号。
在编辑窗口中,将光标放在某行上的
键入小于号 (<) 开始一个新元素。
出现一个下拉列表,该列表提供可在此插入点添加的有效元素。或者,也可以按“Ctrl+J”显示该下拉列表而无需键入小于号。
选择“anonymousIdentification”。
anonymousIdentification 元素(ASP.NET 设置架构)元素即放置在 Web.config 文件中并结束。如果元素是由结束标记结束的,则存在可设置的可用子元素。如果元素的结束方式与下面的 anonymousIdentification 元素相同,则不存在要设置的可用子元素。
将光标放在
出现一个下拉列表,该列表提供可添加到 anonymousIdentification 元素的有效属性。或者,也可以按“Ctrl+J”显示该下拉列表而无需按空格键。
选择“启用”。
enabled 属性被放置在 Web.config 文件中,由于它是一个布尔属性,在一个下拉列表中提供了 true 和 false 值。
选择“false”。这是系统默认值。
IntelliSense 系统会提示插入点的可用元素和可用属性。有时不会提供专用属性。例如,在配置 siteMap 元素(ASP.NET 设置架构)等元素的 providers 元素时,可用属性是不同的,具体取决于要添加的提供程序的类型。IntelliSense 不显示这些属性,因为它们取决于 type 属性的值。
将 enabled 属性的值更改为无效值 "falsex"。
IntelliSense 系统提供验证检查,并在所有未通过验证的文本下面显示一条波浪线。
键入小于号 (<) 开始一个新元素。
出现一个下拉列表,该列表提供可在此插入点添加的有效元素。或者,也可以按“Ctrl+J”显示该下拉列表而无需键入小于号。
使用 IntelliSense 编辑配置设置
在 Visual Web Developer 中打开 Web.config 文件。在编辑窗口中,将光标放在某行上的
<system.web> </system.web>标记内,但不要放在其他任何标记内。
键入小于号 (<) 开始一个新元素。
出现一个下拉列表,该列表提供可在此插入点添加的有效元素。或者,也可以按“Ctrl+J”显示该下拉列表而无需键入小于号。
选择“anonymousIdentification”。
anonymousIdentification 元素(ASP.NET 设置架构)元素即放置在 Web.config 文件中并结束。如果元素是由结束标记结束的,则存在可设置的可用子元素。如果元素的结束方式与下面的 anonymousIdentification 元素相同,则不存在要设置的可用子元素。
复制代码 | |
---|---|
<anonymousIdentification /> |
<anonymousIdentification />标记内,然后按空格键。
出现一个下拉列表,该列表提供可添加到 anonymousIdentification 元素的有效属性。或者,也可以按“Ctrl+J”显示该下拉列表而无需按空格键。
选择“启用”。
enabled 属性被放置在 Web.config 文件中,由于它是一个布尔属性,在一个下拉列表中提供了 true 和 false 值。
选择“false”。这是系统默认值。
IntelliSense 系统会提示插入点的可用元素和可用属性。有时不会提供专用属性。例如,在配置 siteMap 元素(ASP.NET 设置架构)等元素的 providers 元素时,可用属性是不同的,具体取决于要添加的提供程序的类型。IntelliSense 不显示这些属性,因为它们取决于 type 属性的值。
将 enabled 属性的值更改为无效值 "falsex"。
IntelliSense 系统提供验证检查,并在所有未通过验证的文本下面显示一条波浪线。
示例
下面的代码示例演示 Visual Web Developer 创建的 Web.config 文件的初始内容。为 compilation 和 authentication 元素提供的是默认设置。若要启用 ASP.NET 调试,所需全部操作是将 compilation 元素的 debug 属性更改为 true。可以在 system.web 元素中出现的所有元素都在 ASP.NET 配置设置 中进行了说明。复制代码 | |
---|---|
<?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the Web Site Administration Tool to configure settings for your application. Use the Web site->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in /Windows/Microsoft.Net/Framework/v2.x/Config --> <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> <appSettings/> <connectionStrings/> <system.web> <!-- Set compilation debug="true" to insert debugging symbols into the compiled page. Because this affects performance, set this value to true only during development. --> <compilation debug="false"/> <!-- The <authentication> section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. --> <authentication mode="Windows"/> <!-- The <customErrors> section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm"/> <error statusCode="404" redirect="FileNotFound.htm"/> </customErrors> --> </system.web> </configuration> |
安全
在应用程序的配置文件中存储敏感信息时,应使用受保护配置对敏感值进行加密。有关配置文件的这一问题以及其他安全问题的更多信息,请参见保证 ASP.NET 配置的安全。相关文章推荐
- 创建 Web.config 文件
- 如何在web.config 或者 app.config 文件中配置自定义节点
- vue-cli创建的项目不需要再创建webpack-config.js文件,因为已经配置过了
- 创建 Web.config 文件详解
- idea14 如何创建传统的web项目 ,添加jar文件
- JavaEE自定义标签:标签类的创建、tld配置文件的创建(位置、如何创建)、Web-XML配置、JSP应用
- idea14 如何创建传统的web项目 ,添加jar文件
- 一种强行指定dll assembly读取其相应*.dll.config配置文件的方法(又名:如何创建.net 的DCOM)
- 如何配置Web.config文件 for ASP.NET
- 如何配置Web.config文件 for ASP.NET
- 如何通过代码修改web.config文件?
- 创建 Web.config 文件
- 创建 Web.config 文件
- 假设一个网站系统存在两个配置文件web.config和config.config,那么我如何读取config.config的配置节呢?System.Configuration名字空间下的接口好象只能读
- VS2005 ASP.NET2.0安装项目的制作(包括数据库创建、站点创建、IIS属性修改、Web.Config文件修改)
- 如何配置Web.config文件 for ASP.NET
- 如何:从Web.config 文件读取连接字符串
- [web.config]如何灵活使用配置文件
- VS2005 ASP.NET2.0安装项目的制作(包括数据库创建、站点创建、IIS属性修改、Web.Config文件修改)
- 若要使他人能够在远程计算机上查看此特定错误消息的详细信息,请在位于当前 Web 应用程序根目录下的“web.config”配置文件中创建一个 <customErrors> 标记。然后应将此 <cust