Foozor
Foozor

Reputation: 23

ASP dynamic stylesheet link href="<%=stylesheet%>" not working

I've been searching for an explanation as to why the following won't execute on the server

<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <link href="<%=CurrentUser.ses.style.css%>" type="text/css" rel="stylesheet">
</head>

But the following will execute just fine

<link href="<%=CurrentUser.ses.style.css%>" type=text/css rel="stylesheet">

(notice the missing "")

I've even tried

<link href="<%=CurrentUser.ses.style.css%>" type="<%=Response.ContentType = "text/css" %>" rel="stylesheet">

But that will change the contenttype for the page and serve it all as being css.

What am I doing wrong?

Upvotes: 1

Views: 856

Answers (1)

HenryChuang
HenryChuang

Reputation: 1459

try this ?

<link href="<%= String.Format("{0}",CurrentUser.ses.style.css)%>" type="text/css" rel="stylesheet">

Upvotes: 1

Related Questions