HighTechTalks DotNet Forums  

Dynamic ASPX Style Sheet not Render in FireFox?

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss Dynamic ASPX Style Sheet not Render in FireFox? in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
coconet
 
Posts: n/a

Default Dynamic ASPX Style Sheet not Render in FireFox? - 12-29-2007 , 01:34 AM






Server is Win2K3/IIS6.

I have an ASPX page with this in the <head> tag:

<link rel="stylesheet" type="text/css" href="<%
Response.Write( "http://" +
Request.ServerVariables["SERVER_NAME"].ToString() +
this.ResolveUrl("~") + "styles/styledefault.aspx"); %>" />



The style.aspx page looks like this:

body
{
background: #655A46 url('<% Response.Write(
this.ResolveUrl("~") + "media/"); %>bg.gif');
color: #543;
font: normal 62.5% "Lucida Sans Unicode",sans-serif;
}

....


The purpose is to have dynamically-changing styles. The page renders
fine with my external and dynamic style sheet in IE7, but in FireFox
the style appears to be ignored. What can I do to make this work?

Thanks.


Reply With Quote
  #2  
Old   
Milosz Skalecki [MCAD]
 
Posts: n/a

Default RE: Dynamic ASPX Style Sheet not Render in FireFox? - 12-29-2007 , 08:21 PM






Howdy,

I reckon it should be:

<link rel="stylesheet" type="text/css" href="<%=
ResolveClientUrl("~/styles/styledefault.aspx") %>" />

Regards
--
Milosz


"coconet" wrote:

Quote:
Server is Win2K3/IIS6.

I have an ASPX page with this in the <head> tag:

<link rel="stylesheet" type="text/css" href="<%
Response.Write( "http://" +
Request.ServerVariables["SERVER_NAME"].ToString() +
this.ResolveUrl("~") + "styles/styledefault.aspx"); %>" /



The style.aspx page looks like this:

body
{
background: #655A46 url('<% Response.Write(
this.ResolveUrl("~") + "media/"); %>bg.gif');
color: #543;
font: normal 62.5% "Lucida Sans Unicode",sans-serif;
}

....


The purpose is to have dynamically-changing styles. The page renders
fine with my external and dynamic style sheet in IE7, but in FireFox
the style appears to be ignored. What can I do to make this work?

Thanks.



Reply With Quote
  #3  
Old   
Jialiang Ge [MSFT]
 
Posts: n/a

Default RE: Dynamic ASPX Style Sheet not Render in FireFox? - 12-30-2007 , 10:19 PM



Hello coconet

I have reproduced the issue with your code. I also tried Milosz's
suggestion, but the problem still exists.

Based on my test, the style sheet works as expected both in Firefox and IE
only when the href attribute of the link tag points to a css file. A
possible reason is that Firefox does not support a server page as a style
sheet. It depends on how Firefox is coded for it. Therefore, my suggestion
is to contact Firefox for further support. (e.g.
http://forums.mozillazine.org/viewforum.php?f=38)

Another workaround is to extract the styles in the apsx file into a
separate css file, and link to the css in your page. Hope it helps.

If you have any other concern or need anything else, please feel free to
let me know.

Happy New Year!

Regards,
Jialiang Ge (jialge (AT) online (DOT) microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
  #4  
Old   
Jialiang Ge [MSFT]
 
Posts: n/a

Default RE: Dynamic ASPX Style Sheet not Render in FireFox? - 01-03-2008 , 09:58 PM



Hi coconet,

Would you mind letting me know the result of the suggestions? If you need
further assistance, feel free to let me know. I will be more than happy to
be of assistance.

Have a great day!

Sincerely,
Jialiang Ge (jialge (AT) online (DOT) microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.