0

I'm trying to set a background image on my ASP.NET (built-in) chart control to an image located on: http://www.example.com/images/logo.png I can access this image in my browser.

But I'm getting this error:

'http:/www.example.com/images/logo.png' is not a valid virtual path.

Notice how 1 / character is removed from the path after the protocol name.

My code:

<asp:Chart ID="chartPriceHistory" runat="server">
</asp:Chart>

I tried this:

chartPriceHistory.BackImage = "http:\/\/www.example.com/images/logo.png"

chartPriceHistory.BackImage = "http://www.example.com/images/logo.png"

Both scenarios throw the same error.

What else could I do?

Adam
  • 6,041
  • 36
  • 120
  • 208
  • 1
    That's not a virtual path. Can you store the image locally and do `~/img/...`? – wazz Feb 26 '18 at 21:13
  • Hmm..you're right...strange as IntelliSense and the documentation state that I could add an URL. Anyway, thank you! Please add your comment as an answer. – Adam Feb 27 '18 at 09:44
  • I saw the same, path can be absolute or virtual but didn't see any examples of virtual. If you can, add a sample working path to a comment. (If it's really different than the ex in the answer.) – wazz Feb 27 '18 at 18:02
  • I meant to say i didn't see any examples of absolute. – wazz Feb 27 '18 at 21:38

1 Answers1

1

That's not a virtual path. Can you store the image locally and do ~/img/...?

wazz
  • 4,953
  • 5
  • 20
  • 34