I will suggest that you use an underscore like login_username
, so that you can take advantage of model binding while passing data from the view to the controller.
Meanwhile you cannot declare the below code as a class attribute
public string login-username { get; set; }
NOTE
if you must use the dash, then consider using IFormCollection
in ASP.NET core or FormCollection
in ASP.NET
[HttpPost]
public IActionResult Index(IFormCollection collection)
{
var login_username = collection["login-username"];
//Other logic here
return View();
}
Also you can still make use of the model binding but with extra lines of code and some other stuff see this