How can I show a viewbag as html?

Everyone is correct in the use of @Html.Raw() but I want to point out to be careful with this, as it can make your site susceptible to XSS vulnerabilities. I would combine the @Html.Raw(ViewBag.SomeMessage) with Microsoft’s Anti-XSS Library to make sure you do not introduce any vulnerabilities from this. Edit: The advantage of the Anti-XSS … Read more

Model binding comma separated query string parameter

Here’s my improved version of Nathan Taylor’s solution used in archil’s answer. Nathan’s binder could only bind sub-properties of complex models, while mine can also bind individual controller arguments. My binder also gives you correct handling of empty parameters, by returning an actual empty instance of your array or IEnumerable. To wire this up, you … Read more

Why use fluentvalidation instead of ASP.NET MVC validation

Fluent validation is one way of setting up dedicated validator objects, which you would use when you want to treat validation logic as separate from business logic. The aspect-oriented programming (AOP) paradigm enables separation of cross-cutting concerns within a system, and validation is one such concern. Separating validation helps clean up your domain code and … Read more

tech