Asp.net MVC provides lots of (and very useful) HtmlHelper extensions. But what if I was to provide a micro sub-framework with some extension methods that extend existing ones?
i.e. BeginForm may be rewritten to be more rich (always adding security stuff like anti forgery token and similar.
Question
In order to not rewrite all of the Asp.net MVC's HTML helper methods how can I enforce usage of mine? So that the using usual BeginForm would either throw an exception or not be accessible in the first place. The second choice is likely not possible without removing System.Web.Mvc.Html namespace from view's folder web.config file. This would mean that all of those helpers would need rewriting. And that's something I don't want to do.
The thing is that when this micro sub-framework is used it should prevent usage of standard helpers for security reasons. Period.
What other options are there for me?
Example
Suppose I would only write my own BeginForm that I would call BeginSecureForm so one would use it as:
@using Html.BeginSecureForm() {
...
@Html.EditorFor(m => m.Something)
...
}
As you can see I've used my custom helper and standard EditorFor helper as well. This means that System.Web.Mvc.Html is still included to use non-custom helpers like EditorFor.
Upper code works fine as long as you use my custom helper method... But what if some developer would forget to do so and use the normal one instead?
@using Html.BeginForm() {
...
@Html.EditorFor(m => m.Something)
...
}
Well in this case I would either like to:
Html.BeginFormnot being accessible at allHtml.BeginFormthrows an exception that the secure version should be used- anything else I don't know can be done to prevent usage of standard
BeginForm

BeginFormhelper. Let's say it will be calledSecureBeginForm. But not other helpers... So whenever one would use i.e.Html.EditorForeverything would be fine, but if they usedBeginFormit should throw an exception or not be available to execute... Get it? - Robert Koritnik