Blog: 2016 May

How to programmatically retrieve the deployment time of an ASP.NET web site

May 26, 2016, (updated on August 24, 2017), Software Development

In one of my web projects, I wanted to append the web site deployment time to the JavaScript URLs. This way the browser uses the cached file version until a new web site version is deployed. To do so, I looked for a way to read the deployment time of the currently running ASP.NET web site. It’s actually very simple, just read the modified date of the applications Web.config: var configPath = Server.MapPath("~/Web.config"); var deploymentTime = File.GetLastWriteTime(configPath); Do you known a better way to do this? Update: Retrieve deployment time in ASP.NET Core [HttpGet("deployTime")] public DateTime GetDeployTime([FromServices]IHostingEnvironment hostingEnvironment) { var […] Read more...


  Page 1 of 1