Can someone explain to me why we need to use
@using (Html.BeginForm("CheckUser", "Home", FormMethod.Post))
Instead of :
@Html.BeginForm("CheckUser", "Home", FormMethod.Post)
What is the main purpose of @using in here, as far as I know, I only use 'using' keyword to make sure that the object is disposed as soon as it goes out of scope. I am a little confused.
I am asking this question because @Html.BeginForm outputs a text : "System.Web.Mvc.Html.MvcForm {" before rendering the content of the form. And by using the 'using' keyword this text is not rendered.
Edit: This is my code that renders the "System.Web.Mvc.Html.MvcForm ..."
@Html.BeginForm("CheckUser", "Home", FormMethod.Post)
<label for="username">Username :</label>
<input type="text" name="username" id="username" placeholder="username"/>
<label for="password">Password :</label>
<input type="password" name="password" id="password" placeholder="password"/>
<input type="submit" value="Submit" />
@{Html.EndForm();}