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

推荐订阅源

W
WeLiveSecurity
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
Microsoft Azure Blog
Microsoft Azure Blog
The Register - Security
The Register - Security
Stack Overflow Blog
Stack Overflow Blog
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
S
SegmentFault 最新的问题
V2EX - 技术
V2EX - 技术
Hacker News: Ask HN
Hacker News: Ask HN
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
P
Proofpoint News Feed
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
AI
AI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Google DeepMind News
Google DeepMind News
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
U
Unit 42
腾讯CDC
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
The Cloudflare Blog
H
Help Net Security
Recent Announcements
Recent Announcements
P
Privacy & Cybersecurity Law Blog
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LINUX DO - 热门话题
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
H
Heimdal Security Blog
博客园 - 聂微东
S
Securelist
大猫的无限游戏
大猫的无限游戏
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog

博客园 - CrazyCoder

Ubuntu 7.10安装mplayer出现failed to load: drvc.so错误的解决办法 Google Docs Presentation is live now! 你是哪种类型的程序员? 在团队中建立领导能力 国内Ruby On Rails最新动态 framework vs. library learning MVC handling popup window in Watir Top 6 List of Programming Top 10 Lists Reflector 5 Released LINQ/C# Learning Guide - via TheServerSide ProgrammingBooks.org first work day of 2007, first work day in new company 2006年的最后一天,以及2007,我最Google的期望 一些安装VS2005 SP1的技巧 下一版VS.NET的一些新功能 [读书笔记]软件开发中,人和过程的关系 Windows Vista SDK released ideaWins,微软推出了免费的Office Accounting 2007 Express
QueryString中的加号不见了
CrazyCoder · 2007-10-17 · via 博客园 - CrazyCoder

现在手上的项目中使用了ClickOnce技术来部署客户端,客户端有时需要从服务器传一些参数,对于ClickOnce部署的程序来说我们可以在launch的URL中使用query strings来达到这一目的。参照MSDN上的文章,很快就写完了代码。好了,试试看。部署,从服务器launch客户端,似乎一切正常,所有参数的值都顺利得到了。

可还没等Check-in代码,一个测试就失败了。Debug了半天才发现原来是一个参数值中又加号:+。在使用HttpUtility.ParseQueryString分析query string后参数值中的加号变成了空格,以前似乎没遇到过这样的现象。Google了一下才知道原来加号在query string是保留用来代表空格的,要在query string中传这些保留字符必须对query string进行编码。

修改了服务端的代码,想当然的在客户端加了decode的方法,没想到结果还是不对。查了MSDN关于HttpUtility.ParseQueryString方法的帮助才知道原来这个方法内置会对query string进行解码(decode)并返回包含结果的NameValueCollection。

忙了半天最后终于搞定了。

总结一下:

1)安全起见query string一定要encode

2)HttpUtility.ParseQueryString会自动做decode,不要画蛇添足。

happy coding!

~ Crazy