0

I'm just testing some screens in my MVC application for HTML input in some fields of text and I'm not sure what's wrong.

For most of the fields the validation summary is shown as expected but when I enter text with some suspect characters like <b>bold</b> the framework invalidates the model before any controller code is hit and then I just get an empty response from the server.

The string property in question is decorated in my model like this:

[StringLength(1000, ErrorMessage = "Must be under 1000 characters long"), DataType(DataType.MultilineText, ErrorMessage = "Text Error")]

Why would the validation on this one field generate an empty response?

Jammer
  • 9,969
  • 11
  • 68
  • 115
  • Post more code. You may be misreading where the problem is--maybe the controller doesn't get hit because something is failing in the model binder, or you have your form set up oddly? Also, take a look at the request and see what is being sent to the server. – Phil Sandler Mar 21 '14 at 14:33
  • Could ASP be returning the error _A potentially dangerous request.Form value..._? If so, you may want to take a look to some SO questions like [this one](http://stackoverflow.com/questions/81991/a-potentially-dangerous-request-form-value-was-detected-from-the-client) or [this other one](http://stackoverflow.com/questions/17254354/asp-net-mvc-a-potentially-dangerous-request-form-value-was-detected-from-the-cli) – Daniel J.G. Mar 21 '14 at 17:34

0 Answers0