0

I've implemented authorizationfilter to check if user access to the view. Along with that there is readonly attribute that needs to be attached to the view in the application.

Is context.Items only way to store the readonly property in authorization filter to retrieve it in controller.

Sunny
  • 4,765
  • 5
  • 37
  • 72

2 Answers2

2

To access a property in all views, you can inherit from a WebViewPage and reference that in the view web.config.

To access a property in all controllers, build a base controller with the logic you want and inherit the base in all your application controllers.

Jeremy Holovacs
  • 22,480
  • 33
  • 117
  • 254
0

If you are using at least MVC3, then you can use ViewBag:

filterContext.Controller.ViewBag.MyVariable = "some data";
Zbigniew
  • 27,184
  • 6
  • 59
  • 66