Link to home
Start Free TrialLog in
Avatar of Tomazaz
Tomazaz

asked on

styleSheetTheme and full url

Hello,

I use style sheets in ASP.NET application <pages styleSheetTheme="t_native">
When I open asp.net web page in browser I see that

<link href="App_Themes/t_native/main.css" type="text/css" rel="stylesheet" />

added to web page. Everything is correct except that I need to use full URL of css file, now it is "App_Themes/t_native/main.css", I need to have "http://www.mydomain.com/App_Themes/t_native/main.css" 

How to do that?
Avatar of CB_Thirumalai
CB_Thirumalai
Flag of India image

If you have
   <link href="App_Themes/t_native/main.css" type="text/css" rel="stylesheet" />
the page that contains this code will take the context and load the style from the location. You never need to use a full path.  Even if you want to use then,
   <link href="http://www.mydomain.com/App_Themes/t_native/main.css" type="text/css" rel="stylesheet" />

I think it is advisable to use the first one, as even if the web address changes, you never need to worry about the path.
Avatar of Tomazaz
Tomazaz

ASKER

I need to use full url as I asked because I am rewriting url dynamically in my asp.net application.
So my actual url of asp.net applications look like

http://www.convertcenter.com/convertunit.aspx/Data_Storage

and in this case relative/absolute URLs do not works. I need to use full URL.
I am not sure if this works, just try it out.

1. Have a Literal control, as <asp:Literal ID="litStyle" runat="server"><asp:Literal>
2. In the Code file in wherever method you want just assign the value of link to the text property as
litStyle.Text = "<link href=\"http://www.mydomain.com/App_Themes/t_native/main.css\" type=\"text/css\" rel=\"stylesheet\" />";
why can not put the tag



directly in the ASPX page?
Avatar of Tomazaz

ASKER

I can but I will loose CSS in design time, also I do not want to use hack, ASP.NET offer style sheet solution.
Yes obviously.  Coz, the full url will always work, even if you do a URL rewrite, when you put it directly as I said in the first post.
ASKER CERTIFIED SOLUTION
Avatar of Tomazaz
Tomazaz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial