Bohdan Kuts
Bohdan Kuts

Reputation: 607

Adding manual version number of site to web.config

I need to show version number of site near site logo. Where in web.config I can save this version number? And is this a good idea to save site version number in web.config?

Upvotes: 6

Views: 3305

Answers (1)

Johnny_D
Johnny_D

Reputation: 4652

Well seems you would get minuses for this question. But anyway here is my advice:

Store you website version in web.config appSettings section, e.g.:

<appSettings>
  <siteVersion>v1.0</<siteVersion>
</appSettings>

And since you are using mvc add to common _layout view code to display this version:

Site version : @ConfigurationManager.AppSettings["siteVersion"]

Yes, this is good idea, as this section of web.config is used to store common settings of you app, and changing them on the fly causes IIS to restart you application in order to apply settings. But not sure you would change site version only while deploying.

Upvotes: 4

Related Questions