开发者

Get value from string formed as URL in ASP.NET

开发者 https://www.devze.com 2023-02-16 04:27 出处:网络
Ok, I have a string of the form string temp = \"http://www.example.com?file=666111&submitter=Betty&origin=Office&telNo=05555\";

Ok, I have a string of the form

string temp = "http://www.example.com?file=666111&submitter=Betty&origin=Office&telNo=05555";

what I need to do is extract the value of the file variable in order to use it. If this was the referrer url I could've done Request.QueryString and got it but the problem is that I have it as a string variable.

I could try to do substring and get the value but I was hoping there was a cleaner way t开发者_运维技巧o do this?


Perhaps you can use the HttpUtility.ParseQueryString method. It returns a NameValueCollection with all parameters.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号