0

I'm new to asp.net/vb.net. I have a string that is in querystring format, that is the string is formatted: 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"). 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. Is this possible?

1 Answer 1

3

HttpUtility.ParseQueryString, you can call it in any context as it just expects string parameter. Just add a reference to System.Web, you can do it even it desktop apps.

http://msdn.microsoft.com/en-us/library/ms150046.aspx

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for the answer, could you please tell me what I'm doing wrong i'm still getting errors and i'm completely stuck I implemented it as below how should I have done it? :
code Public Shared Sub ProcessString(ByVal Istring As String) Dim var As NameValueCollection = HttpUtility.ParseQueryString(Istring) Dim Params As String = IPN.QueryString("var1") End Sub 'code'
Ask it as another question. Include your code and information on the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.