Your model contains fields, not properties (no getter/setter) so the model binder cannot set the values. Change your model to
public class LoginModel
{
public string Username { get; set; }
public string Password { get; set; }
}
More Related Contents:
- Adding another “Pet” to a Model Form
- Razor View throwing “The name ‘model’ does not exist in the current context”
- How can I pass parameters to a partial view in mvc 4
- Razor actionlink autogenerating ?length=7 in URL?
- How to link HTML5 form action to Controller ActionResult method in ASP.NET MVC 4
- How do I create a MVC Razor template for DisplayFor()
- MVC4 DataType.Date EditorFor won’t display date value in Chrome, fine in Internet Explorer
- How do I specify different Layouts in the ASP.NET MVC 3 razor ViewStart file?
- How to add Web API to an existing ASP.NET MVC 4 Web Application project?
- How to pass IEnumerable list to controller in MVC including checkbox state?
- ASP.NET MVC 3 – Partial vs Display Template vs Editor Template
- In MVC3 Razor, how do I get the html of a rendered view inside an action?
- Razor-based view doesn’t see referenced assemblies
- Why is my CSS bundling not working with a bin deployed MVC4 app?
- ASP.NET MVC load Razor view from database
- Differences between Html.TextboxFor and Html.EditorFor in MVC and Razor
- Razor View Engine : An expression tree may not contain a dynamic operation
- How to display an image from a path in asp.net MVC 4 and Razor view?
- MVC 5 Dynamic Rows with BeginCollectionItem
- asp.net mvc keep object alive, information
- WebAPI Delete not working – 405 Method Not Allowed
- Set disable attribute based on a condition for Html.TextBoxFor
- Why is DisplayFormat DataFormatString not working?
- MVC4 enum and radio button list
- How to compile cshtml before runtime
- How to create a function in a cshtml template?
- MVC 4 how to validate a non-US date with client validation?
- Razor Nested WebGrid
- Include all files in a folder in a single bundle
- Html.Raw() in ASP.NET MVC Razor view