该用法常用在用户控件as…","url":"https://www.cnblogs.com/nine425/archive/2010/02/22/1671108.html","mainEntityOfPage":{"@type":"WebPage","@id":"https://www.cnblogs.com/nine425/archive/2010/02/22/1671108.html"},"image":"https://assets.cnblogs.com/logo.svg","publisher":{"@type":"Organization","name":"惯性聚合","logo":{"@type":"ImageObject","url":"https://juhe.plus/apple-touch-icon.png"}},"author":{"@type":"Person","name":"ms_dos"},"datePublished":"2010-02-22T05:26:00.000Z"}]}
惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
T
Threatpost
C
CERT Recently Published Vulnerability Notes
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Security Archives - TechRepublic
Security Archives - TechRepublic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
K
Kaspersky official blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Attack and Defense Labs
Attack and Defense Labs
N
News and Events Feed by Topic
Project Zero
Project Zero
H
Heimdal Security Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Know Your Adversary
Know Your Adversary
Google Online Security Blog
Google Online Security Blog
W
WeLiveSecurity
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Schneier on Security
Schneier on Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
N
News | PayPal Newsroom
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hacker News: Front Page
L
LINUX DO - 热门话题
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
Cloudbric
Cloudbric
V
Vulnerabilities – Threatpost
Hacker News: Ask HN
Hacker News: Ask HN
S
Securelist
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
TaoSecurity Blog
TaoSecurity Blog
NISL@THU
NISL@THU
N
News and Events Feed by Topic
S
Security Affairs
The Last Watchdog
The Last Watchdog
T
Tor Project blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
The Exploit Database - CXSecurity.com
Simon Willison's Weblog
Simon Willison's Weblog
P
Palo Alto Networks Blog
AWS News Blog
AWS News Blog
P
Proofpoint News Feed
C
Cisco Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
LINUX DO - 最新话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Tenable Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Schneier on Security

博客园 - ms_dos

数据库中char(13)+char(10)转换为页面的换行 System.DBNull的用法 CustomValidator验证CheckBoxList必须选择且只能选择一个 GridView编辑状态下DropDownList的联动 - ms_dos - 博客园 GridView单元格换行 - ms_dos - 博客园 js实现indexOf - ms_dos - 博客园 AspxCallBack控件的CallBack事件 js实现精确到小数点后几位的四舍五入函数 HyperLink控件邦定参数 - ms_dos - 博客园 CSS实现圆角DIV - ms_dos - 博客园 值得收藏的22个搜索下载免费PDF电子书的网站 游标的使用方法 [转]Sql Server遍历表记录 将页面滚动条置于顶端 div居中 - ms_dos - 博客园 窗口全屏 JS实现一行内多列DIV同高 - ms_dos - 博客园 动态显示男女性别的两种方法 OnClientClick属性中的换行符 - ms_dos - 博客园
ResolveUrl的用法 - ms_dos - 博客园
ms_dos · 2010-02-22 · via 博客园 - ms_dos

<script src='<%=ResolveUrl("~/UserControls/M3/Validate.js") %>' type="text/javascript"></script>

该用法常用在用户控件ascx页面文件内。

这种方式的好处是:不管引用该用户控件的aspx页面在哪个路径,ResolveUrl都能找到正确的Validate.js文件位置,当然前提条件是("~/UserControls/M3/Validate.js")这个相对路径要正确。

另外,符号'~'只能用在服务器端控件上,所以

<script src="~/UserControls/M3/Validate.js" type="text/javascript"></script>

这种写法是错误的。