ASP.NET - Themes and Relative Referencing

Posted by user70192 on Stack Overflow See other posts from Stack Overflow or by user70192
Published on 2009-06-03T11:10:32Z Indexed on 2010/05/17 13:20 UTC
Read the original article Hit count: 265

Filed under:
|

Hello,

I have an ASP.NET application that uses themes. Let's pretend I have a theme named "MySkin".

I have a page that is in a sub-directory of my application. When I reference a page that uses "MySkin", I noticed that ASP.NET renders a link element that walks up to the root of the site and then down into the App_Themes directory. Here is an example link element I found in a rendered ASP.NET page:

<link href="../../App_Themes/MySkin/theme.css" type="text/css" rel="stylesheet" />

Is there a reason that the rendered link element does not use the following instead:

<link href="/App_Themes/MySkin/theme.css" type="text/css" rel="stylesheet" />

Is this a browser compatibility issue or is there another reason?

The reason I am asking is because I am rendering my ASP.NET page using Server.Execute and storing the result in a different directory. Because of this, I would prefer to use the second way to reference my theme's css.

Thank you!

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about themes