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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -