Cool .NET Tips and Tricks #6
By Dr. Dexter Dotnetsky
Printer - Friendly Version
Dr. Dotnetsky

Well, It's Dr. Dotnetsky again! Yep, they let me out of my cage for a short break in the real world to torment you all with more of my fantastic rants and valuable illuminating technical prose! Hey, Don't eat quiche! Real programmers don't eat it. They don't even know how to spell quiche. They like Oreo Cookies,Twinkies, Coke, and palate-scorching Szechwan food. They like Wasabi mixed with Soy Sauce and ginger, and their favorite catch phrase is "He who laughs last probably remembered to make a backup". And lately, real programmers spend lots of time revising their resume.

Running multiple IIS web sites on Windows XP Professional

As we all know, Windows XP Professional, being God's Great Grant to the programming community, has version 5.1 of IIS, which only supports a single web site (and other absolutely silly restrictions, such as the 10 connection limit, etc). Hey, look over there! Isn't that Bill Gates? (Made ya look, ha ha!).

To make it simple, you can actually create multiple web sites in Windows XP Pro just like in Server. The only catch is that you can't have them all running at the same time. However, if you have the situation where you are developing or work on several web sites and one or more have the requirement that they must be the "root site" of the web rather than a vroot (Virtual Directory), then this little trick is for you! (Actually this process of insisting that a project must be engineered only to work properly in the web root is something Dr. Dotnetsky recommends avoiding, but it seems to be all too common these days).

Make it Happen!

All you need to do is copy the C:\WinNT\System32\Inetsrv\IISAdmin folder and its contents from any Windows 2000 SERVER machine to the same location on your Windows XP Pro machine. Then go into IIS Manager snap-in and set this as a virtual directory in the Default web site (which of course, up until this time was the only web site you had in there). Now open up Internet Explorer and navigate to the web - based IIS Admin pages at http://localhost/IISAdmin, and you get the rest. Create as many new Web Sites as you like, just make sure that only one is turned on at any one time.

When I first tried this, I got a page error at line 88 of the new site wizard ASP page, but I stuck in my favorite line of VBScript code, "On error resume next" and that fixed the little booger! (My grandmother, who lived to be 100 years old, used to try and put in "on error resume previous", but it never used to work. She also turned me on to Clan McGregor Scotch, though, so she couldn't have been all bad).

VB Code Commenter Add In

For you die-hard VB Programmers who've deluded yourselves into thinking that switching to .NET and using VB.NET as your primary language of choice would be easier and more productive than just biting the bullet and learning C# from the ground up, the GotDotNet Team has released Visual Studio.NET Powertoys for VS.NET 2003 which includes the VB Code Commenter. This is an add-in that allows you to type three apostrophes (that's apostrophes, not apocalypses - the symbol for an apocalypse is ☺) and hit the ENTER key, and get the same XML documentation templating for your classes and methods that we superior C# coders have had since VS.NET was invented. You can generate XML documentation for Intellisense or use it with another add-in or with open-source products like NDoc to create cool CHM Help files.

Use Hex codes for colors in System.Drawing

All the methods of System.Drawing.Color bypass the use of Hex codes which are commonly used in HTML. However, there is a method using one argument that you can use:


If you use only one Int32 as an argument, you can preface your Hex code with '&H78' and it will work perfectly - - like this:


Locating ASP.NET and Visual Studio.NET bug and hotfix information

Yes, even Visual Studio.NET 2003 has bugs. Here are some valuable custom search links to searches at MSDN online that should prove helpful to you:

Well, that's it for me this week. Cya!


Dr. Dexter Dotnetsky is the alter-ego of the forums, where he often pitches in to help answer particularly difficult questions and make snide comments. Dr. Dotnetsky holds no certifications, and does not have a resume. Always the consummate gentleman, Dr. Dotnetsky can be reached at  Dr. Dotnetsky's motto: "If we were all meant to get along, there would be no people who wait for all the groceries to be rung up before starting to look for their damn checkbook."