For some reason, I get a run-time exception when I try to use Page.ResolveURL or Url.Content in the default main master page (Site.Master) in my newly created asp.net mvc application. This is very strange because I have been using the ResolveURL helper function in .NET for many years without any problems. Here is my code snippet:
<link href="<%= Url.Content("~/css/style.css"); %>" rel="stylesheet" type="text/css" />
And here is the runtime error that occurs on the same line:
Compiler Error Message: CS1026: ) expected
If I change href to a static url, everything will be ok. Also, this is a new ASP.NET mvc project .... this was the first line of code I changed.
source
share