将 asp.net 代码发布到服务器...通过 MasterFIle 获取路径问题

发布于 2025-01-07 02:17:01 字数 2612 浏览 3 评论 0原文

我尝试将我的应用程序从我自己的 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" />
                &nbsp;|&nbsp;
            <%
                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" />
                <%

                %>
                &nbsp;|&nbsp;
                <%
                }
            %>
            <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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是在用心讲痛 2025-01-14 02:17:01

如果您需要解析非服务器标记中的路径,请使用 ResolveUrl:

<li runat ="server" id="Home"> <a id="current" href='<%= ResolveUrl("~/Home/Home.aspx") %>' title="Home"><span>Home</span></a></li>

此外,如果您使用主题,对于图像,请考虑将 SkinId 与 asp:Image 一起使用。对于背景图像,将声明移动到主题文件夹下的 css 中。

In case you need to resolve path in non-server tags, use ResolveUrl:

<li runat ="server" id="Home"> <a id="current" href='<%= ResolveUrl("~/Home/Home.aspx") %>' title="Home"><span>Home</span></a></li>

Also, if you use theming, for images consider using SkinId with asp:Image. For background images, move declarations to css under theme folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文