asp.net-mvcmarkitup

Exposing a BBCode parser action?


What I'm talking aboit is having a controller like:

[HttpPost, ValidateResult(false)]
public String Preview(String value) {
    return BBCode.ToHtml(value);
}

So user can reference it by url. Is that normal? Probably this is not a high priority question, but I'm just curious?

Thanks!


Solution

  • Normally controller actions should return ActionResults. So a more correct version of your code would be:

    [HttpPost, ValidateResult(false)]
    public ActionResult Preview(String value) {
        return Content(BBCode.ToHtml(value));
    }