1. Create view with one index method
public class TestParametersController : Controller
{
public string Index(string name, int age = 0)
{
return HttpUtility.HtmlEncode("hello " + name + ", your age is " + age);
}
}
2. Run the program and go to
http://localhost:53274/TestParameters?name=frank&age=20
3. The following message will be displayed
hello frank, your age is 20
No comments:
Post a Comment