Solved

Dynamically reskinning asp.net application to allow different look and feel for different companies

Posted on 2008-06-26
5
336 Views
Last Modified: 2013-11-07
OK, I'm well aware the most likely solution is based on master pages and themes/styles... but bear with me here.

We have an application at present to do with vehicle tracking. It's currently written in classic vanilla vbscript on good ol' asp.  We have several companies that do installations for us that want to be able to offer their "own" tracking site based on ours, but with their company logo and colour scheme.

I am currently in the process of redeveloping our existing site into asp.net anyway, so it seems to make sense to build in this sort of "white labelling" exercise whilst I'm doing that.

We will, therefore, have a setup whereby our own existing site needs to sit alongside resellers of our product, utilising the same code, webserver and database server.  These resellers of our product will want to use their own domain names rather than subdomaining off our domain, but they will not be able to host our code on their server, it is essential that there is only one set of code files to maintain, I do not want a situation whereby there are multiple copies of identical asp.net pages spread around that need updating every time I change one word on the page!

Utilising host-headering, I can point any relevant reseller domain to share the same starting directory on the webserver. However, if I do this then the incoming customer will start off with the same page. This won't do...  Each reseller will have a starting "log in" page (hopefully all sharing the same file) but the page needs to be already skinned when that resellers customer arrives at the page. It's no good having a page with a default theme which the reseller's customer logs in on, then gets the appropriate reseller theme from that point onwards, it has to be the correct theme from the first page served up... default.aspx.

My brains a bit fudged up at present, I can't conceive of a way to use the host-headering to pre-apply the relevant theme (which is what needs to happen) by the incoming customer gets to the log-in page.

For example, customer A is a customer of "acme tracking" so he goes to "www.acme-tracking.com" and expects to see Acme's logo up there, with their colour scheme of orange and green.  However, customer B is a customer of "Tracking UK" so he goes to "ww.tracking-uk.com" and expect's to see tracking uk's logo and their colour scheme of pink and blue...  

Both customers will type in their relevant URL and both will hit my server. The host header is set so that those url's are associated with my "vehicletrackingApp" sub-directory in wwwroot and they both hit "default.aspx" in that sub-directory. How can I make each one see the correct appearance for their version of the home login page?

Can I do this or do I need to have a separate subdirectory for each franchise with a separate log-in page in each one, which then redirects the customer somehow to a common "vehicletrackingcommon" subdirectory that holds the REAL files for the application?

I'm sure I'm missing an obvious solution here, but I just can't see the wood for the trees!
0
Comment
Question by:carled
  • 3
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21887706
One possibility is to use a master page file, and a base class for each page that provides the Theme and StylesheetTheme value, and the get the values from the base class, and get the skins and CSS files that are specific to a company.
0
 
LVL 1

Author Comment

by:carled
ID: 21889678
Thanks, TheLearnedOne. Could you possibly elaborate just a little bit more on that?  I understand the base class, but do you mean that the base class somehow interrogates the host header (via "HTTP_HOST") and then uses that value to do a database lookup, etc...?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21945317
I used to have an example of this, in my previous assignment, but I don't have that now.  It would be something like this:

Public Class BasePage

    Inherits Page
 

    Private m_theme As String = "Default"
 

    Public Overrides Property Theme() As String

        Get

            Return m_theme

        End Get

        Set(ByVal value As String)

            m_theme = value

        End Set

    End Property
 

    Private m_styleSheetTheme As String = "Default"
 

    Public Overrides Property StyleSheetTheme() As String

        Get

            Return m_styleSheetTheme

        End Get

        Set(ByVal value As String)

            m_styleSheetTheme = value

        End Set

    End Property
 

End Class

Open in new window

0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 21945322
Default.aspx.vb:


Partial Class _Default

    Inherits BasePage
 

End Class

Open in new window

0
 
LVL 1

Author Comment

by:carled
ID: 21946220
I'll go and play with that, many thanks!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now