Skip to content

Instantly share code, notes, and snippets.

@woodss
Created December 4, 2014 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodss/53aad4a669b8071fc3d2 to your computer and use it in GitHub Desktop.
Save woodss/53aad4a669b8071fc3d2 to your computer and use it in GitHub Desktop.
Global ViewData[] Across Controllers in C# MVC
public abstract class GlobalController : Controller {
public GlobalController() {
ViewData["AvailableEverywhere"] = "This information is available throughout the application!";
}
}
/* USAGE */
public class HomeController : GlobalController {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment