Shared MVC Razor functions in several views
(Here’s a more detailed version of the existing answers.) Create a folder called App_Code in the root of the MVC project if it doesn’t already exist. In here, create an empty razor view and name it whatever you want: Add @helpers and/or static methods to it as needed: @helper ShowSomething() { <span>Something</span> } @functions { …