David Neale
David Neale

Reputation: 17038

ASP.NET WebForms view engine unable to parse server-side tag

I have the following line in an MVC view:

<meta name="msapplication-starturl" 
    content="<%= Url.BaseServerHttpUrl() + gaPinningCampaign %>" />

This simply renders out:

 <meta name="msapplication-starturl" 
     content="&lt;%= Url.BaseServerHttpUrl() + gaPinningCampaign %>" />

The way I found round it was to prepend an empty string do this:

<meta name="msapplication-starturl" 
     content="<%= "" + Url.BaseServerHttpUrl() + gaPinningCampaign %>" />

Any ideas why the parser is getting confused and what a cleaner way to get around this would be?

Upvotes: 0

Views: 141

Answers (1)

user571646
user571646

Reputation: 665

Just remove runat="server" from head tag,

Upvotes: 1

Related Questions