ASP.Net - Path Issues Caused by Coded URLs

I am building a web store and I am having a problem with some urls.

I have a large catalog of sections and categories in my database, which I use to create my main menu.

URLs are of the form Application / Store / Department / Category (All store URLs are rewritten in store.aspx? Querystringstuff)

The problem is that some of the URLs generated by my code work, but prevent the CSS page from loading properly.

Exactly those URLs in which the source text contains slashes. Of course, I am encoding the source URL, but I still have a problem.

My css is linked on the main page -

 <link rel="stylesheet" type="text/css" href="~/CSS/Layout.css" runat="server">

Examples of links that work -

Ice machines

http://localhost:1079/ABCWeb/Store/Refrigeration+Equipment/Ice+Machines.aspx

http://localhost:1079/ABCWeb/Store/Catering+%26+Buffet/Steam+Table+Pans.aspx

, -

/

http://localhost:1079/ABCWeb/Store/Tabletop/Napkin+Holders%2fDispensers.aspx

/Cheesemelters

http://localhost:1079/ABCWeb/Store/Cooking+Equipment/Salamanders%2fCheesemelters.aspx

, URL- , .

 private static System.Text.StringBuilder AppendAnchor(this System.Text.StringBuilder str, string[] path)
{   
    return str.Append("<a href='")
        .Append(path.Aggregate((a, b) => a + "/" + HttpUtility.UrlEncode(b))) 
        .Append(".aspx'><span>")
        .Append(HttpUtility.HtmlEncode(path[path.Length-1]))
        .Append("</span></a>");
}

!

0
2

, . "~" , .

, , , ...

css  

../../CSS/Layout.css

css
 

../../../CSS/Layout.css"

, - , ,

<link rel="stylesheet" type="text/css" href="<%=Request.ApplicationPath+"/Css/Layout.css" %>" />

, , , . , , hierchy , .

0

, -. - ASP.NET ~ , .

<link rel="Stylesheet" type="text/css" href="~/Css/MyCssFile.css" runat="server" />

ASP.NET URL- , , URL-.

+2