Q:

How do i display a variable in a  element after requesting the data from a POST request using razor(C#) and html

I noticed that this would work if i don't use Request["name"]; But obviously I need to get the information from my form. I want to display the 'name' in a confirmation message. I am using visual studio asp.net empty webapp
This is the razor code
 @{
    string title = "This is the title";

    string name = "";
    if (IsPost)
    {

        name = Request["name"];
        string email = Request["email"];
        string message = Request["message"];
    }
}

<p>@name</p>

let me know if i should include any other code, but i think this is all you need to see.

A:

I figured out a much easier solution then the other answers.
@{
    string title = "This is the title";

    var names = "";
    var emails = "";

    if (IsPost)
    {
        var name = Request["name"];
        var email = Request["email"];
        string message = Request["message"];

        names = name;
        emails = email;
    }
}

By reinitializing the Request["name"]; into another variable, it allows me to use the names variable or emails variable in my html. This makes the use of MVC redundant and is more simple.
<p>Name: @names</p>

