Chronozoom.UI.PageInformation.GetFileVersion C# (CSharp) Method

GetFileVersion() private method

Used to obtain a versioning value that can be used in a query string when linking static content such as .js and .css files. The versioning value changes every time the file is changed, and can be used so that browsers do not need to be manually refreshed by users when static content changes. For example, x.js?v=2014-12-31--17-30 is seen by browsers as a different file compared to x.js?v2015-01-01--00-00. It should be noted that this particular approach is not be suitable for a web farm unless sticky IPs are used on the load balancer.
private GetFileVersion ( string webPath = "" ) : string
webPath string Optional path to static content file such as .js or .css file. Leave blank to use assembly build date/time.
return string
        private string GetFileVersion(string webPath = "")
        {
            DateTime rv;

            if (webPath == "")
            {
                // use assembly date/time (from when last built)
                rv = File.GetCreationTime(System.Reflection.Assembly.GetExecutingAssembly().Location).ToUniversalTime();
            }
            else
            {
                // get date/time from file specified in webPath
                FileInfo info = new FileInfo(HttpContext.Current.Server.MapPath(webPath));
                rv = info.LastWriteTimeUtc;
            }

            return rv.ToString("yyyy-MM-dd--HH-mm-ss");
        }
    }