a href="xn--fiqr16adi7bgnc.xn--dqr445bdw4a.xn--j6w193g">隆鎮,Hacker News,Network Security,Hacker News,1N4148
Create 404 Custom Error for IIS 5.0 - Web Server Tricks,Web Server Tricks
Microsoft IIS‎ > ‎IIS 5.0‎ > ‎

Create 404 Custom Error for IIS 5.0

Create 404 Custom Error for IIS 5.0 (Part I)
 
Navigate:  Part I - Part II - Part III


Purposes of a 404 File Not Found Error
 
The fundamental usage for a "404 File Not Found" error handling pages is to bring the user to a page which show additional  information when the page being request is not existed in the web server.  

Technically speaking,  when the web server being requested with an url which cannot be resolved to a specific webpage, it tries to return the client (Web browser) a web page with the HTTP header of "HTTP/404" saying that "404 File Not Found". 
 
For an example, if you try to visit the google.com with a page that is not exist, for example: http://www.google.com/filenotfound 

The web browser may send the following request:

GET http://www.google.com/filenotfound HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: www.google.com

 
HTTP/1.1 404 Not Found
Content-Type: text/html; charset=UTF-8
X-Content-Type-Options: nosniff
Date: Mon, 14 Jun 2010 09:51:57 GMT
Server: sffe
Content-Length: 1366
X-XSS-Protection: 1; mode=block


<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>404 Not Found</title>
<style><!--
body {font-family: arial,sans-serif}
div.nav {margin-top: 1ex}
div.nav A {font-size: 10pt; font-family: arial,sans-serif}
span.nav {font-size: 10pt; font-family: arial,sans-serif; font-weight: bold}
div.nav A,span.big {font-size: 12pt; color: #0000cc}
div.nav A {font-size: 10pt; color: black}
A.l:link {color: #6f6f6f}
A.u:link {color: green}
//--></style>
<script><!--
var rc=404;
//-->
</script>
</head>
<body text=#000000 bgcolor=#ffffff>
<table border=0 cellpadding=2 cellspacing=0 width=100%><tr><td rowspan=3 width=1% nowrap>
<b><font face=times color=#0039b6 size=10>G</font><font face=times color=#c41200 size=10>o</font><font face=times color=#f3c518 size=10>o</font><font face=times color=#0039b6 size=10>g</font><font face=times color=#30a72f size=10>l</font><font face=times color=#c41200 size=10>e</font>  </b>
<td> </td></tr>
<tr><td bgcolor="#3366cc"><font face=arial,sans-serif color="#ffffff"><b>Error</b></td></tr>
<tr><td> </td></tr></table>
<blockquote>
<H1>Not Found</H1>
The requested URL <code>/filenotfound</code> was not found on this server.

<p>
</blockquote>
<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor="#3366cc"><img alt="" width=1 height=4></td></tr></table>
</body></html>



What is Internet Information Server (IIS) 5.0?
 
Internet Information Server (IIS) 5.0 is one of the default server components in Windows 2000 Server or Windows 2000 workstation. It responsible for providing Web server, SMTP and FTP services.   

Steps for setting up customer "404 page not found" handler:

The followings are steps for setting customer "404 page not found" handler.  I will use the Windows 2000 Workstation as an illustration. 

  1. From the start menu, choose Settings and then choose Control Panel
  2. Then the control Panel will be come up, click the Administration Tools icon as followings:
  3. You will see the screen change to Administrative Tools. Then click the "Internet Information Services" icons:
  4. The "Internet Information Services" window will be come up. On the left panel, spread the list under the name of your computer. In our example, the computer's name is win2000java, spread the list and most probably you will see: Default FTP Site, Default, Web Site, and Default SMTP Virtual Server or something that are similar. If you cannot see the items, please check your installation. The screen should look like the following:
  5. Use your mouse to select any Web Site item you want to change the "404 file not found" handling. In this case, we have only one web site item, which is "Default Web Site". Right click the icon, you will get a context menu, select the "Properties":
  6. In the Properties window, click the "Custom Errors" tag, and you will see a list of "Error Messages for HTTP Errors", select the "404" in the list and click the "Edit Properties" button:
 

 Navigate:  Part I - Part II - Part III