【问题标题】:Can I disable #include in ASP.NET?我可以在 ASP.NET 中禁用#include 吗?
【发布时间】:2010-11-20 16:26:17
【问题描述】:

我无法使用 google 找到任何东西...如果我在我的 ASP.NET 代码页上写:

<!-- #include file="file_to_include.aspx" -->

文件被输出到页面。如何禁用此行为?


#includeServer Side Include (SSI) 上的 MSDN 信息

【问题讨论】:

    标签: asp.net file include


    【解决方案1】:

    更新的答案 现在有更多的牛铃!

    事实证明,您可以在 IIS 的 Web 服务扩展管理器 中禁用服务器端包含:

    只需选择Server Side Includes 并点击Prohibit 按钮。

    答案 #2较新的答案

    IIS 中的disabling server side includes 怎么样?


    旧答案

    如果您使用Server Side comment,应该可以。

    试试这个:

    <%--  <!-- #include file="file_to_include.aspx" --> --%>
    

    【讨论】:

    • 感谢您的回答 - 我正在寻找一个更全球化的解决方案,以便完全防止这种行为。
    • 干杯 - 我会试试这个。感谢您的帮助!
    • ooo 不知道服务器端 cmets!热
    • 如果您忘记了,您可以使用 Visual Studio 中的注释代码键盘快捷键 (ctrl-k, ctrl-u)
    • @Gortok - 您在此处引用的命令禁用通过服务器端包含 (SSI) 中的 #exec 运行命令行。但是,它不会完全禁用 SSI。
    猜你喜欢
    • 1970-01-01
    • 2016-03-18
    • 2014-03-13
    • 2014-01-24
    • 1970-01-01
    • 2010-10-07
    • 2020-04-19
    • 1970-01-01
    • 2014-05-21
    相关资源
    最近更新 更多