A easy way to use C# to Parse a URL
来源:互联网 发布:菊花泡水后变绿 知乎 编辑:程序博客网 时间:2024/05/21 06:41
I find it from here, and it is a good solution.
using System;using System.Web; //need to change the property of the project target framework into 4, not clientusing System.Collections.Specialized;namespace test1{ class Program { static void Main(string[] args) { Uri tmp = new Uri("http://www.google.co.uk/search?hl=en&q=parsing+a+url+in+c%23&aq=f&aqi=g1g-j9&aql=&oq="); Console.WriteLine("Protocol: {0}", tmp.Scheme); Console.WriteLine("Host: {0}", tmp.Host); Console.WriteLine("Path: {0}", HttpUtility.UrlDecode(tmp.AbsolutePath)); Console.WriteLine("Query: {0}", tmp.Query); NameValueCollection Parms = HttpUtility.ParseQueryString(tmp.Query); Console.WriteLine("Parms: {0}", Parms.Count); foreach (string x in Parms.AllKeys) Console.WriteLine("\tParm: {0} = {1}", x, Parms[x]); Console.ReadLine(); } }}
- A easy way to use C# to Parse a URL
- An Easy Way to Make a Treemap
- A SIMPLE WAY TO USE SELECT (socket)
- An easy way to customize a scrollbar for a control
- A better way to parse XML documents in .NET (zz)
- A way to learn
- A quite easy way to send email in ABAP
- A easy way to save the filelist in linux
- Is this a good/right way to use generic interface?
- Sodium: A Modern and Easy-to-Use Crypto Library
- a simple and easy way to export grid(grid view) to excel
- find a way to escape
- Fighting: A way to technic
- A long way to go
- How to consume your time in your developing and how to use a efficient way?
- A Guide to use SSL
- How to Use Kdiff3 as a 3-way Merge Tool With Mercurial, Git, and Tower.app
- Building a higher-level query API: the right way to use Django's ORM
- 405. The finest diamond must be cut. 玉不琢,不成器
- Hibernate整体体验
- 虚拟机VLAN网络配置
- 第十一章 图像之清屏
- jdom xpath定位带xmlns命名空间的节点
- A easy way to use C# to Parse a URL
- 移值FFMPEG到iPhone或Mac OS/X
- NULL
- ubuntu桌面-安装屏幕录像软件
- 开发人员为何应该使用 Mac OS X 兼 OS X 小史
- 脚本安装后的 glance 上传镜像文件
- 脚本安装
- alsa音频架构
- 安装KVM监控virt-manager