Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: Provide support for specifying required action parameter from body [265]

$
0
0

Currently the [Required] attribute can be used on properties but not on the type itself or on the parameter. So when sending a request with empty body to the POST action below, the ModelState.IsValid would return true even though everything is missing. Right now we don't have good ways of specifying a required body parameter.

public POST(LoginModel login)
{
if (ModelState.IsValid)
{
// do something with the login parameter
}
}

public class LoginModel
{
[Required]
public string UserName { get; set; }

[Required]
public string Password { get; set; }
}


Comments: This is a dup of issue 24.

Viewing all articles
Browse latest Browse all 7215

Trending Articles