Last post Jul 27, 2011 04:29 PM by Scal
Jul 26, 2011 02:10 PM|GViktor|LINK
How can I define global variable what is available for each pages? I tired to use PageData. I've put it into _PageStart. When I open a page then the stored value in the PageData is reseted because of it runs each time when I open a page...
Jul 26, 2011 02:51 PM|pranavkm|LINK
There's a property called
App that could be used to share data across all pages and user sessions.
Use the Session property if you want to share data across all pages on a per-user basis.
Jul 26, 2011 07:41 PM|mikesdotnetting|LINK
If you name a file _AppStart.cshtml and add it to the root folder, you can set global values in that. _AppStart.cshtml runs once when the application first starts.
App.Discount = 10;
App.Color = "Blue";
Jul 27, 2011 12:22 PM|GViktor|LINK
Thanks for quick support!
Jul 27, 2011 04:29 PM|Scal|LINK
Or use the Web.Config file and retrieve value with the Configuration Manager