将 asp.net 代码发布到服务器...通过 MasterFIle 获取路径问题
我尝试将我的应用程序从我自己的 PC 发布到服务器“C:\Development\MyApp” 在我的电脑上一切正常,但当我发布应用程序时,服务器我的 MasterPage 丢失了标题的所有图像...它也有选项卡问题,当我单击选项卡时,它告诉我路径不正确,并且文件夹/文件不存在。
这是主文件中的我的代码,我没有看到任何可能导致此问题的异常情况,我希望您这样做:)。
<div id="topContant"
style="background-image: url('/App_Themes/Sugar2006/images/Header.jpg')">
<table cellspacing="0" cellpadding="0" border="0"
style="height: 80px; width: 100%;">
<tr>
<td height="60" rowspan="1">
<img alt="" class="style1"
src="/App_Themes/Sugar2006/images/assisted-living-concepts.gif" />
</td>
<td align="left" valign="top" nowrap class="style2" style="padding-right: 10px;">
<asp:Label ID="WelcomeUser" runat="server" Text="Welcome: " ForeColor="White"></asp:Label>
<br />
<asp:HyperLink ID="lnkMyAccount" Text="My Account"
NavigateUrl="~/Users/MyAccount.aspx" style="color:White" CssClass="myAreaLink"
Runat="server" Font-Size="Small" />
|
<%
if (CPDManagement._code.Security.IS_ADMIN) {
%>
<asp:HyperLink ID="lnkAdmin" Text="Admin"
NavigateUrl="~/Administration/default.aspx" style="color:White"
CssClass="myAreaLink" Runat="server" Font-Size="Small" />
<%
%>
|
<%
}
%>
<asp:HyperLink ID="lnkAbout" Text="About" NavigateUrl="~/Home/About.aspx"
style="color:White" CssClass="myAreaLink" Runat="server" Font-Size="Small" />
<%--<br><%= Application["CONFIG.platform_title"] %>--%>
</td>
</tr>
</table>
</div>
<div id="navcontainer"
style="border-style: outset; border-width: thin; background-color: #663300; height: 30px; ">
<ul id="navlist">
<li runat ="server" id="Home"> <a id="current" href="/Home/Home.aspx" title="Home"><span>Home</span></a></li>
<%--<li runat ="server" id="Tab2"> <a href="" title="Tab 2"><span>Tab 2</span></a></li>--%>
</ul>
</div>
<div>
单击“主页”按钮时,它无法显示“App_Themes”,也无法引用 href="/Home/Home.aspx"。 我尝试在“/”之前放置“~”,或者删除“~”和“/”,但什么也没有。 有什么想法吗?
I trying to publish my app from my own PC to the server "C:\Development\MyApp"
Everything works fine on my PC but when I publish the application the server my MasterPage looses all the images for the header... It also has problems with tabs when I click on a tab it tells me that the path is incorrect and that Folder/File does not exist.
Here is my code from the master file I don't see anything out of ordinary that could be causing this issue I hope you do :).
<div id="topContant"
style="background-image: url('/App_Themes/Sugar2006/images/Header.jpg')">
<table cellspacing="0" cellpadding="0" border="0"
style="height: 80px; width: 100%;">
<tr>
<td height="60" rowspan="1">
<img alt="" class="style1"
src="/App_Themes/Sugar2006/images/assisted-living-concepts.gif" />
</td>
<td align="left" valign="top" nowrap class="style2" style="padding-right: 10px;">
<asp:Label ID="WelcomeUser" runat="server" Text="Welcome: " ForeColor="White"></asp:Label>
<br />
<asp:HyperLink ID="lnkMyAccount" Text="My Account"
NavigateUrl="~/Users/MyAccount.aspx" style="color:White" CssClass="myAreaLink"
Runat="server" Font-Size="Small" />
|
<%
if (CPDManagement._code.Security.IS_ADMIN) {
%>
<asp:HyperLink ID="lnkAdmin" Text="Admin"
NavigateUrl="~/Administration/default.aspx" style="color:White"
CssClass="myAreaLink" Runat="server" Font-Size="Small" />
<%
%>
|
<%
}
%>
<asp:HyperLink ID="lnkAbout" Text="About" NavigateUrl="~/Home/About.aspx"
style="color:White" CssClass="myAreaLink" Runat="server" Font-Size="Small" />
<%--<br><%= Application["CONFIG.platform_title"] %>--%>
</td>
</tr>
</table>
</div>
<div id="navcontainer"
style="border-style: outset; border-width: thin; background-color: #663300; height: 30px; ">
<ul id="navlist">
<li runat ="server" id="Home"> <a id="current" href="/Home/Home.aspx" title="Home"><span>Home</span></a></li>
<%--<li runat ="server" id="Tab2"> <a href="" title="Tab 2"><span>Tab 2</span></a></li>--%>
</ul>
</div>
<div>
The its failing to display "App_Themes" and also fails to reference to href="/Home/Home.aspx" when clicked on the Home button.
I have tried placing a "~" before the "/" or removing the "~" and "/" and nothing.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要解析非服务器标记中的路径,请使用 ResolveUrl:
此外,如果您使用主题,对于图像,请考虑将 SkinId 与 asp:Image 一起使用。对于背景图像,将声明移动到主题文件夹下的 css 中。
In case you need to resolve path in non-server tags, use ResolveUrl:
Also, if you use theming, for images consider using SkinId with asp:Image. For background images, move declarations to css under theme folder.