c# - Set global variable at compile time from cshtml page -
in asp.net web pages 'site', created webmatrix (razor template, c# code).
can set variable in cshtml template 'global' (appstate) without executing page?
i know can set "appstate.whatever = " on page, have 'visit' page, code 'runs'.
can set "something.whatever = " inside te cshtml template, without visiting template. possible if these pages 'compiled' or interpreted when saved. such thing possible?
thanks!
you can add file named _appstart.cshtml root of site. execute when first request made application. can set global variables in that.
look section titled application variables in article here: http://www.mikesdotnetting.com/article/192/transferring-data-between-asp.net-web-pages
Comments
Post a Comment