Question

my site has a few skins, to repsent the UI. These skins are based on the HOSTNAME they are connecting with.

As such, each css file, image, etc needs to be prepended with the correct folder location.

So, i thought that i should put it into the session of the user.

So, which is the earliest place i can/should do this.

Secondly, should I be remembering this in the session, or handling this per request that comes in?

(Please don't mention app_themes - I know about them, etc.)

No correct solution

OTHER TIPS

Why put this in Session? That doesn't make much sense to me. If I needed to modify every URL that came in, I would create an HttpModule. Or alternately, create an HttpHandler for handling requests of type css, jpg, etc.

Also... you realize that by default, IIS does not hand off requests for CSS, images, etc. to the ASP.NET process?

You should just key it off of Request.Url.Host which is already available to you in the Request. For good separation of concerns make themes an enum or something, decide which in your Controller or CodeBehind then pass that enum in your ViewModel your code keys off of (don't know if you're using Web Forms or MVC so this is vague).

You definitely shouldn't store it in Session because this is not something that varies from user to user.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top