how to decode a query string in ASP.NET 2.0

hi,

I have the followin code in a .ascx.cs file:

string myQueryString = Request.QueryString.ToString();

Please, can some one show me how to decode the querystring before I assign it to myQueryString variable?

Thanks
vielkacarolina1239Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

anyoneisSoftware DeveloperCommented:
What do you mean by"decode the query string" What is it that you want to do with it. Why not just use the QueryString collection?

string fooParm = Request.QueryString["foo"]
or
string firstParm = Request.QueryString[1]

David
0
vielkacarolina1239Author Commented:
I am assigning the query string to a variable. The variable contains + for the space and ....

I will like to decode the encoded characters in the query string when I assign it to the variable, myQueryString. I am parsing myQueryString variable my self. I am doing this becuase Request.QueryString["keyName"] cannot have duplicate entries and my query string does have duplicated entries, keys that are repeated.

Please, show me how to decode the query string and assign the decoded value to myQueryString.
0
vielkacarolina1239Author Commented:
When one uses Request.QueryString.AllKeys[x], this piece of code automatically decodes the current key. But the object Request.QueryString.ToString(), has the encoded string.
0
anyoneisSoftware DeveloperCommented:
I believe this will do the trick for you:

        string [] parmArray = Request.QueryString.ToString().Split('&');
        for (int i = 0; i < parmArray.Length; i++)
        {
            parmArray[i] = HttpUtility.UrlDecode(parmArray[i]);
        }

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.