给定一个uri,怎么获取里面的参数值?
比如 uri="http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=e2798a59-79d5-4833-9c57-87d46a8b907a"
怎么获取里面的 forumID的值???
[解决办法]
IndexOf('?')
Split('&')
[解决办法]
参照
string url="http://forum.csdn.net/PointForum/Forum/PostTopic.aspx?forumID=e2798a59-79d5-4833-9c57-87d46a8b907a";string[] urlArrays=url.Split('forumID');string aStr=urlArrays[0];
[解决办法]
System.Text.RegularExpressions.Regex reg=new System.Text.RegularExpressions.Regex("a=([^&]+)");
Uri uri = new Uri("http://www.contoso.com/catalog/shownew.htm?date=today&a=1&b=2");
System.Text.RegularExpressions.Match match= reg.Match(uri.Query);
string a= match.Groups[1].Value;