ASP.NET根路径 [英] ASP.NET root path

查看:147
本文介绍了ASP.NET根路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序与所有相对于根路径的链路写入。现在,当我把它上传到服务器,服务器有两个额外的层面如/应用/ thisapp /所以我所有的链接(没有在服务器上运行)获取broken..is有一个快速的方法来解决这个问题?

I have my app written with all the links relative to the root path. Now, when I upload it to the server, the server has two additional levels like /apps/thisapp/ so all my links(those not run on server) get broken..is there a fast way to fix it?

推荐答案

如果您希望您的所有链接解析为根,可以用做服务器端:

If you want all your links to resolve to the root, you could do it server-side with:

<img src="~/apps/thisapp/images/logo.gif" alt="" runat="server" />

根波浪符(〜/)和runat属性将确保链路的服务器端分辨率的组合

The combination of the root tilde operator ("~/") and the runat attribute will ensure server-side resolution of the link.

这篇关于ASP.NET根路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆