C# .NET - Get multiple querystrings from a web address

Asked By Dom Afonso on 14-Sep-12 06:17 AM
I have a web address with multiple querystrings as shown, below:
http://www.catconsultores.co.mz:83/MuitosQueryStrings.aspx?UserId1=1&UserId2=2&UserId3=3
when I click on the link I want that each value of a query string be passed to specific label on page load like:

Label1.Text=1
Label2.Text=2
Label3.Text=3
The values 1; 2; 3 come form the UserId1, UserId2 and UserId3 of the web address. 

Can anyone show me the c# code to accomplish this?
hiren dhameliya replied to Dom Afonso on 14-Sep-12 07:47 AM
on Page load 

String abc = Request.QueryString[0].ToString();
String pqr = Request.QueryString[1].ToString();
String xyz = Request.QueryString[2].ToString();

Label1.text= abc.ToString(); 
Label2.text= pqr.ToString(); 
Label3.text= xyz.ToString();

or
 on page load event 
Label1.text= Request.QueryString[0].ToString(); 
Label2.text= Request.QueryString[1].ToString() 
Label3.text= Request.QueryString[2].ToString() 



Hemanth Kumar replied to Dom Afonso on 14-Sep-12 08:40 AM
You can get the Query String Values based on the RequestQuery String Collection which is concept in 4.5.
Once try that
http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx