Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 712827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:53:31+00:00 2026-05-14T04:53:31+00:00

Okay, I know it is weird but when I put this code between <head

  • 0

Okay,

I know it is weird but when I put this code between <head runat="server"></head> in master.page, this is how it renders into:

 <link id="ctl00_Link1" rel="shortcut icon" href="../%3C%25%20ResolveUrl(%22~/Resources/Pictures/Shared/Misc/favicon.ico%22);%20%25%3E" type="image/x-icon" />

It doesn’t see something asp.net needs to take care of.

This is the original code :

<link id="Link1" rel="shortcut icon" href='<%=ResolveUrl("~/Resources/Pictures/Shared/Misc/favicon.ico") %>' type="image/x-icon" runat="server" />

Basically Asp.Net doesn’t take care of the code below and renders as a normal html.

How can I get over this problem?

Thanks in advance…

Edit and Resolved

Okay people, there is no way for doing this. I’ve finally figured out because ResolveUrl or ResolveClientUrl is only working for these below :

@import '<%= ResolveUrl("~/Resources/Styles/MainMaster/MainDesign.css") %>';
<script src='Resources/Scripts/Libraries/jquery-1.4.2.js' type="text/javascript"</script>

it is too literal for link so you need to put link elements in body tag like :

<body>
    <link id="iconOne" rel="shortcut icon" type="image/x-icon" href="Resources/Pictures/Shared/Misc/favicon.ico"/>
    <link id="iconTwo" rel="icon" href='Resources/Pictures/Shared/Misc/favicon.ico' type="image/ico" />
</body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:53:31+00:00Added an answer on May 14, 2026 at 4:53 am

    So, the reason you ran into your first issue was because the link tag had runat="server" This tells asp.net to treat it as a server control, rather then a literal. Because its a server control, your scriptlet tag (<%= %>) isn’t really doing anything, since its a server control property it is treating it as literal text.

    There are two ways to handle it. First is to ClientScriptManager to register a startup script. This will put your link tag inside the body, which is the way microsoft says you should do it, but aesthetically isn’t that nice. The other option is to do something like this in your Page_Load

    var link = new HtmlGenericControl("link");
    link.Attributes.Add("rel", "shortcut icon");
    link.Attributes.Add("src", ResolveUrl("~/Resources/Pictures/Shared/Misc/favicon.ico"));
    link.Attributes.Add("type", "image/x-icon");
    
    Header.Controls.Add(link);
    

    This builds out a control programatically, then adds it to the controls collection on the head, which will render as what you want at the end of the head tag. Problem with this is that its a bit more work, and its better to avoid monkeying with control collections at the code behind level if you can get away with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 367k
  • Answers 367k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You haven't said what you want to parse it into:… May 14, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer This is an authlogic and declarative_authorization example that I'm adding… May 14, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer Microsoft has recently released IronPython tools for Visual Studio and… May 14, 2026 at 5:02 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.