ASP.NET MVC 2.0: How to read querystring value
Posted
by Shyju
on Stack Overflow
See other posts from Stack Overflow
or by Shyju
Published on 2010-05-25T15:23:31Z
Indexed on
2010/05/25
15:31 UTC
Read the original article
Hit count: 387
asp.net-mvc-2
|querystring
I am trying to build a small ASP.NET MVC 2 application.I have a controller class with the below method in it
public ActionResult Index()
{
TestMvc.Models.PersonalInformation objPerson = new TestMvc.Models.PersonalInformation();
objPerson.FirstName = "Shyju";
objPerson.LastName = "K";
objPerson.EmailId="[email protected]";
return View(objPerson);
}
And when the page (View) being called, i can see this data there as my view has these data's displaying. Now i want to know how can i pass a query string in the url and use that id to build the PersonalInformation object.Hoe can i read the querystring value ? Where to read ?
I want the quesrtstring to be like http://www.sitename/user/4234 where 4234 is the user id
© Stack Overflow or respective owner