简体   繁体   中英

CSS bindings while using url routing

I have asp .net 4.0 application in which i am implementing url routing. I have defined my routes in global asax and able to call them correctly.

but my problem is when I am calling a route with parameters my css was not binded properly .

I linked my css files as follows in my master page.

       <link id="Link1" rel="stylesheet" type="text/css" href="~/css/style.css" runat="server" />
<link id="Link2" rel="stylesheet" type="text/css" href="~/css/menu.css" runat="server" />

when i am calling a route with a page my css bindings are being changed as follows in my page source behind.

      <link id="Link1" rel="stylesheet" type="text/css" href="css/style.css" />
      <link id="Link2" rel="stylesheet" type="text/css" href="css/menu.css" />

and when there is a route value

      <link id="Link1" rel="stylesheet" type="text/css" href="../css/style.css" />
      <link id="Link2" rel="stylesheet" type="text/css" href="../css/menu.css" />

when i have two route values

    <link id="Link1" rel="stylesheet" type="text/css" href="../../css/style.css" />
    <link id="Link2" rel="stylesheet" type="text/css" href="../../css/menu.css" />

并且全局asax.cs中的以下代码为我工作。

     Routes.Ignore("{folder}/{*pathInfo}", new { folder = "my images path" });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM