[英]Get values from string in querystring format vb.net
I'm new to asp.net/vb.net. 我是asp.net/vb.net的新手。 I have a string that is in querystring format, that is the string is formatted: value1=data1&value2=data2...
我有一个采用querystring格式的字符串,即该字符串的格式为:value1 = data1&value2 = data2 ...
I need a way (i'm sure theirs probably a built in function for it) to be able to get the value for any given field such as Dim data1 = string.querystring("value1"). 我需要一种方法(我确定它们可能是内置函数)才能获取任何给定字段的值,例如Dim data1 = string.querystring(“ value1”)。 I googlged it and found the function querystring but it only seems to work on getting straight from a URL, but I have that data stored in a string variable and want to get the data from this.
我对其进行了搜索,发现了函数querystring,但它似乎只能直接从URL获取,但是我已将数据存储在字符串变量中,并希望从中获取数据。 Is this possible?
这可能吗?
HttpUtility.ParseQueryString
, you can call it in any context as it just expects string parameter. HttpUtility.ParseQueryString
,您可以在任何上下文中调用它,因为它只需要字符串参数。 Just add a reference to System.Web
, you can do it even it desktop apps. 只需添加对
System.Web
的引用,即使是桌面应用程序也可以做到。
http://msdn.microsoft.com/en-us/library/ms150046.aspx http://msdn.microsoft.com/en-us/library/ms150046.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.