3

I was using that (with head runat)

<link href="https://<%= AppSettingBase.AppSetting("CdnDomain")%>/cdn/css/iebutton.css" rel="stylesheet" type="text/css" />

it was rendering correctly

<link href="https://cdn.mydomain.com/cdn/Content/css/iebutton.css" rel="stylesheet" type="text/css" />

now I am using (with head runat)

<link href="https://<%= UIAppSetting.CdnDomain%>/cdn/css/iebutton.css" rel="stylesheet" type="text/css" />

it rendering wrong , but without head runat working fine

<link href="https://&lt;%= UIAppSetting.CdnDomain%>/cdn/css/iebutton.css" rel="stylesheet" type="text/css" />

What is difference between two, how can I solve it?

Edit

UIAppSetting is class and CdnDomain is static property and I added namespace in web.config

Govind Malviya
  • 13,627
  • 17
  • 68
  • 94

3 Answers3

0

This answer and this answer (which actually link the first one) states that you can't use <%= %> syntax inside a runat="server" tag, which your head tag actually is. I also find some other pages on internet who state the same.

Given this, I don't understand why it works your first version

<link href="https://<%= AppSettingBase.AppSetting("CdnDomain")%>/cdn/css/iebutton.css" rel="stylesheet" type="text/css" />
Community
  • 1
  • 1
themarcuz
  • 2,573
  • 6
  • 36
  • 53
0

Finally I solved my issue but it is not good way I think. specially thanks to themarcuz, he tried well for me.

<link <% Response.Write("href='https://" + UIAppSetting.CdnDomain +"/cdn/css/iebutton.css'");%> rel="stylesheet" type="text/css" />
Community
  • 1
  • 1
Govind Malviya
  • 13,627
  • 17
  • 68
  • 94
0

I've had something like this before,

does it work correctly if you substitute the

<link href=" blah blah " />

for

<link href=' blah blah ' />

single quotes instead of double quotes, i'm sure I had an issue once where it didn't like the fact that I had a double quote inside a double quote. no matter it's context (although it may have been in an Eval context)

kolin
  • 2,326
  • 1
  • 28
  • 46