c# - ASP 无法加载资源 : the server responded with a status of 404 (Not Found) error in server

标签 c# asp.net

这是我的asp代码

<link id="Link1" rel="stylesheet" runat="server" media="screen" href="~/Styles/css/tableStyle.css" />
    <link id="Link2" rel="stylesheet" runat="server" media="screen" href="~/Styles/css/LoadingStyle.css" />
    <link id="Link3" rel="stylesheet" runat="server" media="screen" href="~/Styles/css/selectStyle.css" />

页面打开但没有样式,我的意思是表格和选择没有我为它们制作的样式。

我试过

在 google chrome 上点击 f12 所以我得到了这些错误:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:31200/~/Styles/css/selectStyle.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:31200/~/Styles/css/LoadingStyle.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:31200/~/Styles/css/tableStyle.css

最佳答案

那是因为如果您浏览到 http://localhost:31200/~/Styles/css/selectStyle.css没有这样的资源。

您可能想要 http://localhost:31200/Styles/css/selectStyle.css .因此,删除 ~您的 href 中的符号:

<link id="Link1" rel="stylesheet" runat="server" media="screen" href="/Styles/css/tableStyle.css" />
<link id="Link2" rel="stylesheet" runat="server" media="screen" href="/Styles/css/LoadingStyle.css" />
<link id="Link3" rel="stylesheet" runat="server" media="screen" href="/Styles/css/selectStyle.css" />

关于c# - ASP 无法加载资源 : the server responded with a status of 404 (Not Found) error in server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22560334/

相关文章:

c# - ASP.Net - 如何包含另一个项目中的嵌入式 JavaScript 文件?

c# - asp.net 中的转发器项目命令

c# - 在后面的代码中获取 jquery ui 对话框的值

c# - 将 RGB 字节转换为 HSL 并返回?

c# - 找出网络核心 3.x 中网络 UNC 路径上的可用空间和总空间

c# - LoggingFactory 在第二次调用时处理

ASP.NET Web API 将 http 响应转换为 json 数组

c# - 在 C# 中用 javascript 覆盖菜单 css

jquery - 将剪贴板中的图像粘贴到 Web 表单

c# - 任务错误处理-Visual Studio停止