Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying .aspx on the end of a css file?

Tags:

asp.net

When working on web apps in ASP.NET, what is the reason for specifying a file as stylesheet.css.aspx rather than just plain stylesheet.css? I have seen this done in various web apps.

The web designer mentioned something about how it's a .NET thing and storing a global variable for the ASPX page but I didn't really understand, nor know the full story.

This is done at my work for a large web app with different sites for different countries. This makes me wonder, when would I make separate web apps for separate countries as opposed to one web app serving different languages? Is there a performance, architectural or other technical reason for doing so? I can think of several non tech reasons (e.g. SEO considerations).

like image 322
Alex Avatar asked Feb 26 '09 14:02

Alex


2 Answers

Probably the stylesheet is not static and is dynamically generated on the server.

This technique can be used to provide a different style sheet by considering several parameters (such as user theme selection or something).

Clarification: While you can map .css extension in IIS to be handled by ASP.NET. It has two problems:

  1. Static CSS files will also get handed down to ASP.NET runtime, which will cause a small performance loss.
  2. In many shared hosting environments, you don't have any control on IIS handler mappings.

Web browsers don't care (at least, they shouldn't care) about the extension or anything else about the URL. The only thing they should care about is the Content-Type header. It should be set to text/css; otherwise some of them may complain.

like image 144
mmx Avatar answered Sep 22 '22 07:09

mmx


A stylesheet is just a text file - you can specify any file extension you want as long as your <link> matches. In other words this will work:

<link type="text/css" rel="stylesheet" href="style.foobar"/>

as long as your stylesheet has that name. I can't think of any reason for naming the stylesheet with a .aspx extension as it is misleading and confusing. [Other posts have good explanations for why this might be used.]

like image 22
Andrew Hare Avatar answered Sep 18 '22 07:09

Andrew Hare