Know your version of Web Application

Once the web application is published to production, after a while it becomes difficult to know exactly which version is in production. One of the way to find it without any ambiguity is to flash the version number on the footer tag next to copyright text.

Code in aspx page

<div id="AssemblyVersionInfo">

Code in Codebehind page

 public string AssemblyVersionInfo { get; set; }

 protected void Page_Load(object sender, EventArgs e)

 private void SetAssemblyVersionInfo()
    Assembly assembly =
Version ver = assembly.GetName().Version;
AssemblyVersionInfo = "Version : "
   + ver.Major.ToString()
   + "." + ver.Minor.ToString()
   + "." + ver.Build.ToString()
   + "." + ver.Revision.ToString();

Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: