Created
August 7, 2012 23:18
-
-
Save mattkruskamp/3290450 to your computer and use it in GitHub Desktop.
Automatically Breaking Js and Css Cache Using Build Number in Asp.Net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string BuildNumber(this HtmlHelper html) | |
{ | |
if (html.ViewContext.HttpContext.Cache["_buildnumber_"] == null) | |
{ | |
var version = System.Reflection.Assembly | |
.GetExecutingAssembly().GetName().Version; | |
html.ViewContext.HttpContext.Cache["_buildnumber_"] = | |
version.Build.ToString(); | |
} | |
return html.ViewContext.HttpContext.Cache["_buildnumber_"].ToString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment