0

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?

2 Answers2

2

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.

Callum Linington
  • 14,213
  • 12
  • 75
  • 154
1

concatenate the params using &

localhost:56698/Default.aspx?lehrlingID=114&id=123904871029

DanielS
  • 744
  • 6
  • 13