title: Bind TagHelper to attribute starting with data-
body: <p>I am currently developing an ASP.Net Core 3.0 pre-release 8 MVC application. I created a custom Tag Helper which looks something like the following, which does basically the same as the existing <code>asp-append-version</code> attribute but with the <code>data-src</code> attribute instead of <code>src</code>:</p>
  
  <pre class="lang-cs prettyprint-override"><code>[HtmlTargetElement(
      "img",
      Attributes = AppendVersionAttributeName + "," + SrcAttributeName,
      TagStructure = TagStructure.WithoutEndTag)]
  public class ImageTagHelper : UrlResolutionTagHelper
  {
      private const string AppendVersionAttributeName = "asp-append-version-lazy";
      private const string SrcAttributeName = "data-src";
  
  
      [ActivatorUtilitiesConstructor]
      public ImageTagHelper(
          IFileVersionProvider fileVersionProvider,
          HtmlEncoder htmlEncoder,
          IUrlHelperFactory urlHelperFactory)
          : base(urlHelperFactory, htmlEncoder)
      {
          FileVersionProvider = fileVersionProvider;
      }
  
      public override int Order =&gt; -1000; 
  
      [HtmlAttributeName(SrcAttributeName)]
      public string? Src { get; set; }
  
  
      [HtmlAttributeName(AppendVersionAttributeName)]
      public bool AppendVersion { get; set; }
  
      internal IFileVersionProvider FileVersionProvider { get; private set; }
  
      public override void Process(TagHelperContext context, TagHelperOutput output)
      {
          if (context == null)
          {
              throw new ArgumentNullException(nameof(context));
          }
  
          if (output == null)
          {
              throw new ArgumentNullException(nameof(output));
          }
  
          output.CopyHtmlAttribute(SrcAttributeName, context);
          ProcessUrlAttribute(SrcAttributeName, output);
  
          if (AppendVersion)
          {
              EnsureFileVersionProvider();
  
              Src = output.Attributes[SrcAttributeName].Value as string;
  
              output.Attributes.SetAttribute(SrcAttributeName, FileVersionProvider.AddFileVersionToPath(ViewContext.HttpContext.Request.PathBase, Src));
          }
      }
  
      private void EnsureFileVersionProvider()
      {
          if (FileVersionProvider == null)
          {
              FileVersionProvider = ViewContext.HttpContext.RequestServices.GetRequiredService&lt;IFileVersionProvider&gt;();
          }
      }
  }
  </code></pre>
  
  <p>Anyway the important part is that the attribute I want is <code>data-src</code>, but as soon as I try to use my Tag Helper in any view it gives me the following error:</p>
  
  <blockquote>
    <p>Invalid tag helper bound property '..'. Tag helpers cannot bind to HTML attributes with name 'data-src' because the name starts with 'data-'.</p>
  </blockquote>
  
  <h2>The actual question</h2>
  
  <p>What is the reason for this, also is there any way to go "around" it?   </p>