Code :
<html>
<body>
@{
if (IsPost) {
string companyname = Request["CompanyName"];
string contactname = Request["ContactName"];
<p>You entered: <br />
Company Name: @companyname <br />
Contact Name: @contactname </p>
}
else
{
<form method="post" action="">
Company Name:<br />
<input type="text" name="CompanyName" value="" /><br />
Contact Name:<br />
<input type="text" name="ContactName" value="" /><br /><br />
<input type="submit" value="Submit" class="submit" />
</form>
}
}
</body>
</html>
I was referring to http://www.w3schools.com/aspnet/webpages_forms.asp to learn basic .NET and I came across this code. I made a new aspx file in visual studio and pasted the code. But its taking the Razor part '@' as text. Can anyone help me out with explaining what I should do to fix this?