惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
TaoSecurity Blog
TaoSecurity Blog
H
Heimdal Security Blog
Help Net Security
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Google DeepMind News
Google DeepMind News
爱范儿
爱范儿
The Cloudflare Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
人人都是产品经理
人人都是产品经理
大猫的无限游戏
大猫的无限游戏
N
News | PayPal Newsroom
V2EX - 技术
V2EX - 技术
博客园 - 【当耐特】
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
C
CERT Recently Published Vulnerability Notes
罗磊的独立博客
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Privacy & Cybersecurity Law Blog
有赞技术团队
有赞技术团队
S
Schneier on Security
S
SegmentFault 最新的问题
Google Online Security Blog
Google Online Security Blog
H
Hacker News: Front Page
The Last Watchdog
The Last Watchdog
Schneier on Security
Schneier on Security
PCI Perspectives
PCI Perspectives
IT之家
IT之家
Project Zero
Project Zero
博客园 - 司徒正美
P
Privacy International News Feed
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Jina AI
Jina AI
Security Latest
Security Latest
Hacker News - Newest:
Hacker News - Newest: "LLM"
腾讯CDC
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
C
Check Point Blog
aimingoo的专栏
aimingoo的专栏
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
NISL@THU
NISL@THU
Webroot Blog
Webroot Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity

博客园 - 齐世昌

.resources文件转.resx 文件 同一Session中的aspx页面的并发限制 Diving Into Lync Client Logins Passing JavaScript Objects to Managed Code UI抑制限制(UI Suppression Limitations) JSON对象末尾多余逗号问题 T430 Windows 8 的USB3.0无法识别 【翻译】数据库上的IO已冻结,不需要任何用户操作 【翻译】为Web Forms添加捆绑(Bundling)和压缩(Minification) 禁用笔记本WiFi热点网络连接问题 推荐一个在线压缩JavaScript和CSS的网站 Windows 8不支持Windows XP 模式 又是一年(2012年) 本地测试网址推荐 text-overflow: ellipsis 在IE8、9下显示问题 Windows Server 2012 不支持SharePoint Server 2010(KB2724471) VirtualPathUtility.IsAppRelative的bug? 受信任站点在Windows 7 和Windows XP的注册表中的不同 contenteditable属性浏览器支持情况(基本支持)-工作草稿
神奇的img
齐世昌 · 2012-07-30 · via 博客园 - 齐世昌

各位童鞋想必对母版页中图片的路径纠结过吧。

美工切图一般都是html,页面中用到都是html标签,图片展示用到的就是img标签了。如果要做母版页,就要考虑纠结的路径问题。img的路径如果是相对母版页的,那和母版页同级目录下的内容页木有问题,子级目录下的内容页图就会破了。

如果站点不会部署到虚拟目录(IIS6)或者非顶级应用程序(IIS7.x),path可以写成’/’开头,从根路径算起。这种路径叫做网站根路径。

解决办法1: 换成服务器端控件asp:Image,路径中使用相对应用程序路径(~)。

解决办法2: 为img添加runat='server'属性,路径中使用对象应用程序路径(~)。 一定要加runat属性

相比较而言,方法2比方法1来,对原有代码修改量要少一些。

ASP.NET 网站路径