diff --git a/src/Microsoft.AspNet.Mvc.TagHelpers/Internal/FileVersionProvider.cs b/src/Microsoft.AspNet.Mvc.TagHelpers/Internal/FileVersionProvider.cs
index cff00bc974..b8bad61709 100644
--- a/src/Microsoft.AspNet.Mvc.TagHelpers/Internal/FileVersionProvider.cs
+++ b/src/Microsoft.AspNet.Mvc.TagHelpers/Internal/FileVersionProvider.cs
@@ -48,6 +48,20 @@ namespace Microsoft.AspNet.Mvc.TagHelpers.Internal
public string AddFileVersionToPath([NotNull] string path)
{
var resolvedPath = path;
+
+ var queryStringStartIndex = path.IndexOf('?');
+ if (queryStringStartIndex != -1)
+ {
+ resolvedPath = path.Substring(0, queryStringStartIndex);
+ }
+
+ Uri uri;
+ if (Uri.TryCreate(resolvedPath, UriKind.Absolute, out uri))
+ {
+ // Don't append version if the path is absolute.
+ return path;
+ }
+
var fileInfo = _fileProvider.GetFileInfo(resolvedPath);
if (!fileInfo.Exists)
{
diff --git a/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Image.html b/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Image.html
index 148485f395..a102c65158 100644
--- a/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Image.html
+++ b/test/Microsoft.AspNet.Mvc.FunctionalTests/compiler/resources/HtmlGenerationWebSite.HtmlGeneration_Home.Image.html
@@ -11,10 +11,22 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+