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

推荐订阅源

P
Proofpoint News Feed
博客园 - 聂微东
Application and Cybersecurity Blog
Application and Cybersecurity Blog
MyScale Blog
MyScale Blog
罗磊的独立博客
H
Help Net Security
L
LangChain Blog
T
Threat Research - Cisco Blogs
量子位
S
Securelist
Last Week in AI
Last Week in AI
L
Lohrmann on Cybersecurity
T
The Exploit Database - CXSecurity.com
P
Privacy International News Feed
The Hacker News
The Hacker News
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
T
Threatpost
Security Latest
Security Latest
P
Palo Alto Networks Blog
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
F
Full Disclosure
WordPress大学
WordPress大学
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Heimdal Security Blog
J
Java Code Geeks
Recorded Future
Recorded Future
Hugging Face - Blog
Hugging Face - Blog
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
阮一峰的网络日志
阮一峰的网络日志
U
Unit 42
B
Blog RSS Feed
月光博客
月光博客
C
Cisco Blogs
V
Visual Studio Blog
D
DataBreaches.Net
H
Hacker News: Front Page
博客园 - 叶小钗
N
News and Events Feed by Topic
爱范儿
爱范儿
A
Arctic Wolf

博客园 - 亦续缘

[CSS]textarea设置下划线格式 赠送google wave邀请函 int[] 和 string[] 互换 - 亦续缘 将字符串转换成List<T> - 亦续缘 - 博客园 Web可用性设计的247条指导方针 line-height和字体实际高度的计算 IIS7用进程池的PID查找占用CPU的站点 UNICODE与汉字编码互转 CSS中属性的书写顺序 TinyMCE在线编辑器用JavaScript取值的问题 给SQL数据库表和字段添加描述信息 javascript 正确截取单字节和双字节混和字符串的方法 - 亦续缘 - 博客园 DataTable转换成JSON字符串的函数 异常详细信息: 不能通过已删除的行访问该行的信息 Web开发利器之IEWebDeveloperV2--有注册码 JavaScript创建命名空间 JavaScript ColorDropDownList - 亦续缘 - 博客园 asp.net Forms验证跨域页面不能访问的问题 语音验证码
HttpUtility.ParseQueryString直接从字符串URL中提取参数
亦续缘 · 2008-04-28 · via 博客园 - 亦续缘

一直都忙着做项目都没空写文章了,今晚在写通过歌曲名称从百度下载歌词的程序时,不小心学到了一个比较好用的方法"HttpUtility.ParseQueryString"不敢独享,特此写下.用法:使用指定的System.Text.Encoding将查询的字符串分析成一个集合(此方法在 .NET Framework 2.0 版中是新增的)。
如:要查询字符串URL(http://box.zhangmen.baidu.com/m?gate=1&ct=134217728&tn=baidumt,想起  &word=wma,http://club.nx.cninfo.net/bbs/upload/audio/ZWdpa2iVaGliYmtkamlwcGZpazQ$.wma,,[%CF%EB%C6%F0]&si=%CF%EB%C6%F0;;%BD%AD%C3%C0%E7%F7;;13098;;13098&lm=16777216)中si参数是否有值,可以用下面的代码直接得到。
引用的命名空间:using System.Collections.Specialized;
string url = "http://box.zhangmen.baidu.com/m?gate=1&ct=134217728&tn=baidumt,想起  &word=wma,http://club.nx.cninfo.net/bbs/upload/audio/ZWdpa2iVaGliYmtkamlwcGZpazQ$.wma,,[%CF%EB%C6%F0]&si=%CF%EB%C6%F0;;%BD%AD%C3%C0%E7%F7;;13098;;13098&lm=16777216";
NameValueCollection queryString = HttpUtility.ParseQueryString(url, System.Text.Encoding.GetEncoding("GB2312"));
if (!string.IsNullOrEmpty(queryString["si"]))
{
    Response.Write(queryString["si"]);
}
这样就可以直接得到si的值是"%CF%EB%C6%F0;;%BD%AD%C3%C0%E7%F7;;13098;;13098",是不是很方便呢!