< ! - #include virtual =“feed.asp” - >不适用于Page.cshtml文件

时间:2013-07-25 17:53:07

标签: asp.net razor

我正在尝试将feed.asp嵌入到Page.cshtml中。但是它没有编译命令。这是页面的代码。

@{

}

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>ONC Project Tracking</title>
        <style type="text/css">
        .auto-style1 {
            text-align: center;
            font-family: Verdana, Geneva, Tahoma, sans-serif;
            font-weight: bold;
            color: #800000;
        }
        .auto-style2 {
            text-align: justify;
            font-family: Verdana, Geneva, Tahoma, sans-serif;
        }
        .auto-style3 {
            font-family: Verdana, Geneva, Tahoma, sans-serif;
        }
        .auto-style4 {
            text-align:center;
            margin-left:auto;
            margin-right:auto;
            border: 0px solid black;
        }
        .auto-style4 tr {
            width: 30%;
        }
        .auto-style4 td {
            border: 0px solid black;
            padding: 0px;
            border-collapse:collapse;
            border-spacing: 0px;
        }
        .auto-style5 {
            max-width: 50%;
        }
        .auto-style11 {
            width: 1077px;
            height: 283px;
        }

    </style>
    </head>
    <body>
        <p class="auto-style1">
        Welcome to the ONC project tracking JIRA system</p>
    <p>
        &nbsp;</p>
    <p class="auto-style2">
        Welcome to the ONC project tracking JIRA system. The Nationwide Health Information Network Division of the Office of National Coordinator maintains the system to provide a collaborative environment for the healthcare industry to implement meaningful use requirements. Below please find links to numerous projects that are hosted on the project tracking system, as well as a summary of the hot topics being discussed. Within each project you will find conversations related to implementing specific meaningful use measures.</p>
    <p class="auto-style3">
        If you have questions about meaningful use direct them to <a href="mailto:mindy.hangsleben@hhs.gov">mindy.hangsleben@hhs.gov</a>. If you&#39;re having technical problems with this site please contact onc-jira@ainq.com.</p>

        <hr>

    <table class="auto-style4">
        <tr>
            <td>
                <img alt="" class="auto-style5" src="high-priority-tickets-button.png" /></td>
            <td>
                <img alt="" class="auto-style5" src="hot-tickets-button.png" /></td>
            <td>
                <img alt="" class="auto-style5" src="issues-due-this-week-button.png" /></td>
        </tr>
        <tr>
            <td>
                <img alt="" class="auto-style5" src="create-a-ticket-button.png" /></td>
            <td>
                <img alt="" class="auto-style5" src="latest-tickets-button.png" /></td>
            <td>
                <img alt="" class="auto-style5" src="my-new-tickets-button.png" /></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>
                <img alt="" class="auto-style5" src="my-profile-button.png" /></td>
            <td>&nbsp;</td>
        </tr>
    </table>



   < !--#include virtual="feed.asp"-->

    </body>
</html>

输出'&lt; ! - #include virtual =“feed.asp” - &gt;'而不是呈现asp页面的内容。

2 个答案:

答案 0 :(得分:1)

这是行不通的。

如果您必须包含此asp文件,请尝试使用<iframe> - 但即使这样,您也很难让asp在IIS7中运行(假设应用程序在IIS7上运行)

答案 1 :(得分:0)

我假设您的项目是某种类型的ASP.NET C#Web应用程序(MVC,Site或其他)。这意味着您的默认页面语言是C#。如果您能够让服务器端包含工作,编译器会希望包含的文件也是同一种语言。你不能混合和匹配语言。

我假设.ASP扩展名是文件源是来自经典ASP天的VBScript吗?如果是这样,您将无法组合经典ASP和ASP.NET。

如果由于某种原因feed.asp是一个只有经典扩展名的.NET文件,Response.WriteFile("myFile.aspx")是一种包含另一个文件的方法,但我相信这个文件也需要在C#中。如果您使用MVC,可以使用Html.RenderPartial

您阅读的一些资源:

ASP.NET equivalent of server side includes

http://support.microsoft.com/kb/306575