I have a webAPI that is serving images.
http://{uri}/Data/api/v1/ImageData?objectType=1&dbKey=12
I am trying to consume it in <img>
tag dynamically in c# like this:
var src = string.Format("http://{uri}/Data/api/v1/ImageData?objectType={0}&dbKey={1}", viewType, dbKey);
html.Append(@"<div class='Image'>");
html.AppendFormat(@"<span><img src ='{0}'/></span>", src);
html.Append(@"</div>");
Now, the issue I run into is that I webAPI has a basic authentication that I need to pass a user name and password. How can I do that? unlike this question, I am trying to find better way to pass username and password.