ASP 加载资源失败:服务器响应状态为 404(未找到)错误

use*_*257 3 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" />
Run Code Online (Sandbox Code Playgroud)

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

我试过

在 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
Run Code Online (Sandbox Code Playgroud)

Bel*_*gix 6

那是因为如果您浏览到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" />
Run Code Online (Sandbox Code Playgroud)