Codeine .Net RSS 2.0
# Sunday, 28 October 2007

    I originally thought of this idea while at Professional Edge. We had a client that wanted to build a portal and resell the functionality it provided to other companies. The main functionality and content for the site would be the same for each customer, but styles, images, and logos would change based on each company allowing the company to portray the website as their own. Professional Edge closed before the project was signed off on so I never got the chance to tackle a solution, but every once in awhile the concepts pops back into my head. I am sure this is a fairly common scenario and most likely what I have done here has been done plenty of times before, but I thought I would attempt to put together a proof of concept. My initial plan was to dynamically generate the App_Themes data based on information from the database. Using this method the developer would build the site with the look and feel defined via css tags and skin ids. The end corporate user would then have a user interface to define their custom styles and images that applied to each css tag and skin id. If the user did not define a tag then the website would simple use a default theme that the developer defined.

    To do all this I have utilized the functionality of virtual path providers. A virtual path provider allows you to essentially take over when ASP.NET is looking for the file to server to the user. In my particular case it is for .css and .skin files, so that whenever a request comes in for one of these files it is instead dynamically built based on data from the database. Originally I had planned to associate a particular theme name with each portal's customizations. For example on the pre-init the theme would be dynamically set based on some type of user information, either a login account, or possibly the web address used to access the site. Basically any type of information that establishes the unique portal that the visitor is attempting to reach. Unfortunately this plan won't work. Apparently ASP.NET requires the actual physical files for a theme to exist or else it will throw an error. This was a bit of a disappointment to me as I had hoped to parse the theme name in the virtual path provider to know what dynamic data to load. Since the path is the only data passed into the virtual path provider it is the easiest and cleanest way to know what data to load. If the file trying to be loaded is ThemeABC.css I could load the styles for portal ABC and if the file trying to be loaded was ThemeXYZ.css then I could have loaded the styles for portal XYZ.

    Even though this method didn't work I was able to development another method that does. I have created the file structure for the Default theme with dummy files, including Default.css and Default.skin. Every portal will essentially be using this theme as far as ASP.NET is concerned, but when a request comes in for Default.css or Default.skin I pass back a dynamically generated file. The decision for what styles and ids need to be loaded is based on a cookie that is set in the pre-init. This cookie is then read in the in the Open function of the virtual file class for the virtual path provider and based on what the cookie says a decision is made as to what styles are handed back to the client.

    In the attached sample code there are two different themes that can be accessed, blue and red. Setting the cookie is handled in the Default.aspx's OnPreInit. Since this is a proof of concept the actually string is hard coded, but it could just as easily read the address that the request came in on, a user login, or user setting. Then in the virtual path provider I handle any of the requests that come in for APP_THEME/DEFAULT/. Finally in the virtual file class I read the theme name from the cookie and hand back the proper page. Since this is a proof of concept I have simply hardcoded a few values to hand back, but you could easily query the database and hand back a much more dynamically generated file.

    At this point hopefully you can see the numerous possibilities this allows for. If all the ok buttons on the entire site are defined with a skin id of btnOk then you could allow the user to upload the image they want for their ok buttons and instantly all the ok buttons on the site reflect what the user has defined. If you consistently use your css tags within you site then the user could easily define custom colors, fonts, etc. for each one. This would allow the user to very easily customize the site to the look and feel that represents their company without having a developer make any changes.

    Feel free to check out the sample code at the link below and make any comments or suggestions. Since it is just a proof of concept it is a little rough and not that elegant, but it displays the point.

Download the source code to the proof of concept. (VS2008 required)

    

    

Sunday, 28 October 2007 19:03:34 (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter
ASP.NET | Development
# Thursday, 25 October 2007

    I got pretty excited yesterday when I came across this: Hands on with Gmail's new IMAP support. In the past Gmail has only supported POP and because of the unique way Gmail stores emails, (with tags associated with emails instead of them being in folders) it caused everything to be downloaded to your inbox, even your sent items. Starting this week IMAP has been showing up in the settings of some Gmail users and will continue to be rolled out to the rest. I can only hope that they also add it to Gmail for Your Domain in the Google Apps. Then I can finally make the permanent move away from my Hotmail account.

Thursday, 25 October 2007 07:18:22 (Central Daylight Time, UTC-05:00)  #    Comments [0] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter
Gmail
# Sunday, 21 October 2007

Well for those of you keeping track of my DVR I just wanted to note that with the recent rebuild and upgrade to KnoppMyth R5F1 (It looks like the version is now up to R527. So much for staying current!) I also add two new hardware components. The first was a 500 GB SATA hard drive that I have allocated directly to TV recordings. You can read about how I did this in one of my previous posting. I purchased this hard drive at CompUSA for $127.19. The other item I added was an HD over-the-air tuner card so that I could start watching and recording in high definition. The card I purchased was a pcHDTV hd-5500 for $129 that I bought from StormLogic. StormLogic is selling prebuilt KnoppMyth boxes for $1,157.57. They have the process down pretty well and have contributed several scripts to KnoppMyth. The card installed very easily. After installing the card though I found that my system did not have the processing power to handing watching live HD very well. It also had random issues when anything else wanted to share the processor with it. I resolved this problem, by buying the fastest processor the current motherboard could handle. This turned out to be an AMD Athlon X2 4200+ from NewEgg for $72.50. The fact that the system is now dual core greatly improved the processing power of the DVR and now I have no problems watching or recording HD. I've now got the ability to record three shows at once, two from my cable connection, and one from HD broadcast. I also have the storage capacity now to handle plenty of recordings without worrying about running out of storage space. Lastly, I am now paying for a TV guide subscription through SchedulesDirect. The subscription is down to $20 a year which I can't complain about too much. As a side note, blogging from Word 2007 seems to be working out great and is a lot easier!

Sunday, 21 October 2007 12:57:33 (Central Daylight Time, UTC-05:00)  #    Comments [0] - Trackback - Save to del.icio.us - Digg This! - Follow me on Twitter
DVR | KnoppMyth | MythTV

Navigation
Archive
<2007 October>
SunMonTueWedThuFriSat
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2024
David A. Osborn
Sign In
Statistics
Total Posts: 70
This Year: 0
This Month: 0
This Week: 0
Comments: 33
Themes
Pick a theme:
All Content © 2024, David A. Osborn
DasBlog theme 'Business' created by Christoph De Baene (delarou)