public static class UrlHelperExtensions
{
public static string ContentNoCache(this UrlHelper url, string path)
{
return url.Content("{0}?_dc={1}".FormatWith(path, DateTime.Now.ToFileTime()));
}
}
where FormatWith:
public static string FormatWith(this string input, params object[] args)
{
return string.Format(input, args);
}
Use:
<script src="@Url.ContentNoCache("~/Scripts/app.js")" type="text/javascript"></script>
Result:
<script src="/Scripts/app.js?_dc=129520920501677826" type="text/javascript"></script>
Немає коментарів:
Дописати коментар