Monday, November 28, 2005 10:37:16 PM UTC :: Filed Under ASP.NET

One thing it took me way too long to learn with Visual Studio 2003 is how to customize the default file templates.  Well, it didn’t take me long to customize the templates once I knew where they were, it was finding them that was hard. ;-) 

For example, when you add a new web form to a project, you don’t have to put-up with all the garbage tags in the HTML page header that Visual Studio auto-magically generates. You can modify the ASPX page template to show what you want so you don’t have to modify each new file.  The same can be done with class files, XML, etc.

The template customization feature of VS.NET 2005 is pretty nice and the guys and gals at MSDN have already created a lot of documentation for template customization:

MSDN2: Visual Studio Templates

Monday, November 28, 2005 9:45:14 PM UTC :: Filed Under ASP.NET

There are a couple of web sites out there that cover exactly how I feel most of the time while programming… here’s one of them: http://thedailywtf.com/

Monday, November 28, 2005 4:12:43 PM UTC :: Filed Under ASP.NET
Monday, November 28, 2005 4:10:05 PM UTC :: Filed Under Misc

I didn’t realize Lance Armstrong was a cyclist and a geek like me?  Well, I doubt he is a geek, but Hewlett Packard has introduced a new HP Special Edition L2000 laptop that has a LIVESTRONG™ theme where $50 from each laptop purchase goes to the Lance Armstrong Foundation :

I’m not sure how ‘strong’ an $899 laptop will be, but I suppose HP needed to make it remotely affordable so that people will actually buy it and hence contribute the most money to the Lance Armstrong Foundation.  By the time I got done configuring the laptop into something I’d want, it was $1,600. :-)

Tuesday, November 22, 2005 9:19:57 PM UTC :: Filed Under ASP.NET

Have you ever found it annoying that any time you download some sample code you had to configure a virtual directory in IIS just to see it work, only to delete it if it wasn’t of use to you?  Well, with the .NET 2.0 Framework and a little help from Robert McLaws, you can now browse web sites from anywhere using the new built-in web server feature of ASP.NET 2.0:

"ASP.NET 2.0 Web Server Here" Shell Extension

In the above blog post, Robert had a few issues with his solution which he apparently resolved with the .msi which can be downloaded here.

The coolest part is that it even works on ASP.NET 1.1 projects! w00t!

Tuesday, November 22, 2005 9:04:04 PM UTC :: Filed Under ASP.NET

I’m going to have to make reading Scott Guthrie’s blog part of my daily ritual because nearly every post is packed with useful information!  This article shows how to run a web application on your development PC as though it was running at the top-level (or “root”) web site, even if it’s configured to run in a virtual root:

How to Run a Root “/” Site with the VS/VWD 2005 Local Web Server

Why is this cool?  If you haven’t already figured it out, here’s my lame explanation:

When you configure a web site on a Windows 2003 Server using IIS 6, each site has its own root directory because IIS 6 on a web server allows for the creation of multiple web sites.  However, on a development machine running Windows XP Pro and IIS 5, you can only have one web site defined which means all other sites must be contained in virtual root folders below the main site.   The problem that this creates is that it becomes difficult to reference file paths to static files and folders.

For example, if your site contains an “images” folder and a “templates” folder (which contains your .ASCX user controls), you will likely want to reference images from within one of your user controls.  On a web server, you could reference an image path like this:

<img src=”/images/someimage.gif” alt="My Alt Tag" />

However, that won’t work on a development PC running IIS 5 with a site defined as a virtual root.  The path would then have to be:

<img src=”/myvirtualroot/images/someimage.gif” alt="My Alt Tag" />

Starting to see the problem here?  In the second example, all your images will break when you copy your files from your development PC to the live web server.   Using the “../” method to navigate to images used to work:

<img src=”../images/someimage.gif” alt="My Alt Tag" />

However, do to naughty people trying to run scripts through the address bar in the browser, IIS often won’t allow for the “../” notation.  One solution is to use the method ResolveURL along with the “~/” prefix:

<img src="<%# Control.ResolveUrl(“~/images/someimage.gif”) %>" alt="My Alt Tag" />

But that’s just plain ugly code!   Utilizing Scott’s trick, you can reference your file paths as though you were working on a live web server without having to do any ugly work-around. Schweet!

Navigation
On this page....
Search
Archives
<November 2005>
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
Categories
Contact me
Send mail to the author(s) Contact Todd M. Taylor