asp.net - Web.config:在xml属性中添加注释

标签 asp.net web-config xml-comments

我想在web.config文件中添加评论,如下所示:

<httpRuntime 
  requestValidationMode="2.0"      // require for [ValidateInput(false)] in .net-4.0
  requestPathInvalidCharacters=""  // include & character in the url
  enableVersionHeader="false"      // disable X-AspNet-Version header
  />


是否可以使用<% %>之类的服务器端注释以这种方式添加注释?

最佳答案

web.config文件是XML文件,因此您唯一的选择是使用XML注释:

<!--
   requestValidationMode="2.0" - require for [ValidateInput(false)] in .net-4.0
   requestPathInvalidCharacters=""  - include & character in the url
   enableVersionHeader="false" - disable X-AspNet-Version header
-->
<httpRuntime 
  requestValidationMode="2.0"      
  requestPathInvalidCharacters=""  
  enableVersionHeader="false"      
/>

关于asp.net - Web.config:在xml属性中添加注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2842850/

相关文章:

c# - 使用 PHP 和 MVC 将 XML 文件上传到 Web 目录

asp.net - 用于 Asp.Net Core 的 Kestrel Web 服务器 - 一段时间后是否回收/重新加载

c# - 在完成之前停止中间的 for 循环

c# - 在 WCF 中启用没有 SSL 的基本 HttpBinding

nuget - NuGet 包中的 XML 注释

visual-studio - 使用 Visual Studio 查找缺失的 XML 注释内容

c# - 如何在 web.config 中引用 DLL?

json - 如何禁用 i18next translation.json 文件的缓存?

带有空格的 asp.net web.config 位置路径

c# - 如何查看由 xml-comments 生成的完整文档