razor - Is _AppStart.cshtml an official part of ASP.Net MVC? -
_appstart.cshtml not mentioned often, , when is, seems mentioned part of webmatrix / asp.net web pages opposed mvc proper.
furthermore, this high-scoring stackoverflow answer claims _appstart.cshtml "is not used in mvc." seems either misleading or not true, because if create new empty mvc4 application in visual studio , put in _appstart.cshtml:
@{ throw new exception("uh oh!"); }
your website doesn't work.
so what's "official" recommendation on using _appstart.cshtml? oversight works? or deprecated in mvc5?
(i'm hoping it's not deprecated or frowned-upon because seems convenient way allow site-wide configuration changes without re-deploying /bin , without dealing global.asax or web.config.)
it's official part of web pages framework razor view engine based on. it's part of web pages 3 (which mvc 5 uses) previous versions of web pages.
there no reason why cannot use _appstart.cshtml in mvc. can use other web pages features such @helper
, @function
. of these frowned upon some. long boss or customer isn't among 'some' can use them freely.
if make changes appstart, same effect if had changed web.config. application unload , restart.
appstart introduced simple way access application_start beginners (which web pages aimed at) without them having understand global.asax , events.
Comments
Post a Comment