Reputation: 1601
So I have login with LinkedIn and I'm trying to add a Facebook one.
I already have the "Signin with LinkedIn" button working, and am trying to add the Facebook one:
<div id="socialLoginList">
<p>
@foreach (AuthenticationDescription p in loginProviders)
{
var source = "~/Img/" + p.AuthenticationType + ".png";
<input type="image" src="@source" border="0" id="@p.AuthenticationType" name="provider" value="@p.AuthenticationType" style="max-height: 100%; max-width: 100%">
}
</p>
</div>
If I don't build the path like this, and give it src="~/Img/Facebook.png" or src="~/Img/LinkedIn.png" they work. How can I write the path so the pictures don't appear as broken elements on the page?
Upvotes: 0
Views: 362
Reputation: 5788
If you are using c# 6.0 than you can use Interpolated Strings it'll give you same thing but in much cleaner way
src="@Url.Content($"~/Img/{@source}")"
Upvotes: 1