I want to create some global helper functions. I understood that i must place them in a .cshtml file in App_Code. I created this file:
@helper CreatePostForm(string action, string controller, string id, params string[] hiddens)
{
using (BeginForm(action, controller, System.Web.Mvc.FormMethod.Post, new { id = id }))
{
@Html.AntiForgeryToken()
foreach(string hidden in hiddens)
{
@Html.Hidden(hidden)
}
}
}
The problem is that BeginForm and AntiForgeryToken methods are nor recognized.
How to make it right?
PS: i am using .net 4.5, asp.net mvc 4