Почему при получении запроса POST из Razor View я получаю пустую строку вместо пустой?

I used to receive empty string when there was no value:

[HttpPost]
public ActionResult Add(string text)
{
    // text is "" when there's no value provided by user
}

But now I'm passing a model

[HttpPost]
public ActionResult Add(SomeModel Model)
{
    // model.Text is null when there's no value provided by user
}

So I have to use the ?? "" operator.

Why is this happening?

69
задан Erik Philips 11 November 2015 в 17:39
поделиться