简体   繁体   English

ASP页未检索导入文件

[英]ASP page not retrieving import files

On a newly created website, based on an existing site, the @import is not locating the CSS files. 在基于现有站点的新创建的网站上,@ import找不到CSS文件。 I am just attempting to pull in the CSS files for a simple Hello World in order to make sure that this first step is functioning. 我只是试图为简单的Hello World提取CSS文件,以确保第一步正常运行。

The HTML heading code: HTML标题代码:

<head id="Head1" runat="server">
    <title>Company Name - Hello World</title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

    <style media="all" type="text/css">
        @import '<%# ResolveUrl("~/layout/HelloWorld.css")%>';
    </style>

</head>

Using Chrome, the Developer Tools displays the following: 使用Chrome,开发者工具将显示以下内容:

<html>
<head id="Head1"><title>
    Company Name - Hello World
</title><meta http-equiv="X-UA-Compatible" content="IE=Edge" /><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

    <style media="all" type="text/css">
        @import '';
    </style>

</head>

The folder structure for the site contains the following: 该站点的文件夹结构包含以下内容:

  • HelloWorld -> the root HelloWorld->根
  • -- layout (folder) -布局(文件夹)
  • -- pages (folder) -页数(文件夹)
  • index.aspx 的Index.aspx

  • The code is a cut and paste from the a functioning ASP site. 该代码是从正常运行的ASP站点中剪切和粘贴的。
  • In the developer tools under the Sources option, there are no folder paths being displayed. 在“源”选项下的开发人员工具中,没有显示文件夹路径。
  • The CSS file has been verified to exist in the layout folder. CSS文件已被验证存在于布局文件夹中。
  • The web page displays, but without the CSS formatting. 显示网页,但没有CSS格式。
  • No error messages are generating when displaying a simple one line web page . 显示一个简单的一行网页时,不会产生错误消息。

I have done a side by side comparison of the IIS settings for a working ASP site and the Hello World site, and not differences have been found. 我对工作中的ASP站点和Hello World站点的IIS设置进行了并排比较,但未发现差异。 I am at a loss as to why the @import is displaying as an empty string. 我不知道为什么@import显示为空字符串。

Any wisdom as to how to resolve this is greatly appreciated. 任何有关如何解决此问题的智慧都将受到赞赏。

它应该是:

<link rel="stylesheet" type="text/css" href="~/layout/HelloWorld.css" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM