How to Create Static and Dynamic Websites in IIS and ASP


by Miss ec - Date: 2007-01-12 - Word Count: 547 Share This!

You've got your web server running, and you're ready to dive headfirst into creating your first site or three. How should you set them up? There are a few neat tricks you can do with IIS involving host headers and custom error pages. In this article, I'll describe to you in detail how to use these features to set up dynamic websites that will respond to any domain name, as well as how to set up cystom dynamic file structures that let you name your pages in whatever manner you wish (which is extremely useful for SEO).

I'll assume you already know how to set up a basic web site in the IIS console (right-click, New Site, yadda yadda). If you haven't made a folder for and created a basic site, do that now so we'll have something to play with. Right-click on it once you've created it and go to Properties, then click the Advanced button on the first tab that comes up. This is where you define host headers for your website, what domain names the website should respond to.

If you create an entry for Port 80, but leave the Host Header Name field blank, then IIS will use this site to respond to all requests that the Web Server receives, regardless of the domain! You can then have one site respond to any number of domains or subdomains, and they could even be determined and handled dynamically by the server script language.

Hit OK or cancel to leave the host header window, and on the main properties window go to the Custom Errors tab. Scroll down in the list until you see 404. This is the configuration setting for this website for how IIS responds to requests for pages that do not exist. If you open up the properties of the 404 entry, you can change the Message Type setting to be "URL", and where it says File you can type in "/404.asp" (without the quotes).

Now whenever someone requests a page that doesn't exist at this website, say "www.yourdomain.com/articles/", instead of returning the normal 404 error screen ("page not found"), it will process the "/404.asp" file on your website. That file can then, according to whatever you write the script to do, look in your database for an article with the name of the file that was requested, for example. Thus all of your articles, news, and other dynamic content pages, can also have dynamic URLs -- not dynamic in the sense that they are changing, but in the sense that it doesn't matter what the URL is. You can optimize it completely for SEO, such as "http://www.yourdomain.com/Article-Keywords-Info/".

Of course, your web server will still register that as a 404 hit, but who cares. You can also copy the 404b.htm file from the default directory (look at another web site's setting in IIS to get the default file name and location) to your website root, and then in the dynamic 404.asp file, if the article name can't be found, you can then redirect the user back to the 404b.htm original error page. Perfect!

======================================================================
This article was written by Lucas Green, a professional website developer who
lives off his internet income. Visit www.lucasgreen.com to learn how to use the
internet to create multiple passive income streams and achieve financial freedom!

http://www.LucasGreen.com
======================================================================


Related Tags: websites, create, dynamic, static, asp, 404, iis, host headers, custom errors

Your Article Search Directory : Find in Articles

© The article above is copyrighted by it's author. You're allowed to distribute this work according to the Creative Commons Attribution-NoDerivs license.
 

Recent articles in this category:



Most viewed articles in this category: