0
<link href="<%=this.faviconURL %>" type="image/x-icon" rel="icon" />

It will literally print out '

<link href="%3C%25=this.faviconURL%20%25%3E" type="image/x-icon" rel="icon" />

It's as if the runtime is taking the link tag literally and refusing to do any sort of substitution. Can someone explain why this is happening? I would really prefer not using web controls for this.

Fred
  • 3,786
  • 7
  • 41
  • 52

1 Answers1

1

I think you should add runat to link tag. So It can be processed by Asp.Net.

<link href="<%=this.faviconURL %>" runat="server" type="image/x-icon" rel="icon" />

Apperantly I was wrong see Scriptlet is not working in head tag and you can simple use without runat tag.

<link href="~/server/icofileurl"   type="image/x-icon" rel="icon" />

How to add favicon.ico in ASP.NET site

Community
  • 1
  • 1
adt
  • 4,320
  • 5
  • 35
  • 54
  • I was hoping to avoid using a web control, but it does seem to be the shortest route to success in this case. I would really like to understand *why* this limitation exists though. – Fred Mar 27 '13 at 15:30