Alessandro Minneci Alessandro Minneci - 3 months ago 10
C# Question

How To Request multiple QueryStrings out of one URL?

My URL is built like this: localhost:56698/Default.aspx?

lehrlingID=114

The
lehrlingID=114
that you see at the end of my url gets saved in a variable like this

lehrlingID = Convert.ToInt32(Request.QueryString["lehrlingID"]);`


Now i have to check for another variable as well like this:

string md5key = Request.QueryString["id"];


My URL should look like this then: localhost:56698/Default.aspx
?
lehrlingID=114&?id=123904871029

how can i save the
lehrlingID
and the
id
in 2 different variables even if they are in the same url? And how can i get the QuestionMark
?
between my variables in the url?

Answer

When you create query string it should be in the form of

?lehrlingID=114&id=123904871029

The ? should go on the end of resource like you have:

localhost:56698/Default.aspx?

But after that, it should be key=value&key=value

After that:

Request.QueryString["id"];

Will work as expected.