10.5. Exercises: Controllers and Routing¶
10.5.1. Part 1:
While reading the chapter, you created a basic Hello, World application using ASP.NET
HelloASPDotNET. Open that project up in Visual Studio, and get ready to add some
HelloController class to display a form on a
request that asks the user for both their name and the language they
would like to be greeted in. It should look something like this:
The resulting form submission should return and display the message, “Bonjour Chris”.
The language is presented in a dropdown, more formally known as a
For more information about the
select element and how it works, read the
10.5.2. Part 2:
When the user submits the form (via a
POST request), they should be
greeted in the selected language. Your new feature should:
Include at least 5 languages, with English being the default. If you don’t speak 5 languages yourself, ask your friend the Internet.
Include a new
CreateMessage, in the
HelloControllerthat takes a name as well as a language string. Based on the language string, you’ll display the proper greeting.
10.5.3. Bonus Mission¶
- Add some more HTML and inline styles to your returned greeting response string so that the displayed message looks a bit nicer.