I have a page Product.aspx that has a master page Main.master, both pages are in the root of the project (they don't belong to any folder). The problem is that the tilde path only works for the Main.master, not for products.aspx.
Main.Master:
<head>
<!-- YOUR CUSTOM CSS -->
<asp:ContentPlaceHolder ID="ContentHead" runat="server">
</asp:ContentPlaceHolder>
</head>
products.aspx:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHead" runat="server">
<!-- SPECIFIC CSS -->
<link href="~/css/product_page.css" rel="stylesheet">
<!-- YOUR CUSTOM CSS -->
<link href="~/css/custom.css" rel="stylesheet">
</asp:Content>
When I run the app, the html renders like this:
http://localhost:49573/productos/alivio-de-presion/valvula-alivio-presion-vacio/~/css/product_page.css
I'm using for this page RouteTables in global.asax.cs:
RouteTable.Routes.MapPageRoute("infProds", "productos/{familia}/{nombre}", "~/Product.aspx");
As you can see, the tilde hasn't been translated. I have tried adding runat="server", but it throws an error
Content controls have to be top-level controls in a content page or a nested master page that references a master page
Since I can't add the runat="server" attribute, I cannot use functions like ResolveUrl. I believe there should be an easy way for this, because master pages are meant to work like this, I just don't understand how to deal with paths.
Thanks!