ASP.NET
  Home arrow ASP.NET arrow Page 4 - Setting Up Internet Information Services a...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Setting Up Internet Information Services and ASP.NET
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 16
    2005-11-10

    Table of Contents:
  • Setting Up Internet Information Services and ASP.NET
  • Managing Websites
  • Virtual Directories and Web Applications
  • Custom Errors
  • Installing ASP.NET

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Setting Up Internet Information Services and ASP.NET - Custom Errors


    (Page 4 of 5 )

     

    The Custom Errors tab (Figure 2-12) allows you to specify an error page that will be displayed for specific types of HTTP errors. As you’ll discover in Chapter 11, you can use various ASP.NET features to replace HTTP errors or application errors with custom messages. However, these techniques won’t work if the web request never makes it to the ASP.NET service (for example, if the user requests an HTML file that doesn’t exist). In this case, you may want to supplement custom ASP.NET error handling with the appropriate IIS error pages for other generic error conditions.


    Figure 2-12.  IIS custom errors

    File Mappings

    As explained earlier in this chapter, IIS hands off requests for ASP pages to the ASP service, and requests for ASP.NET pages to the ASP.NET service. However, both ASP and ASP.NET support a variety of file types. How does IIS know which files belong to ASP.NET and which ones belong to ASP?

    The answer is found in the application file mappings. To view file mappings, click the Configuration button on the Virtual Directory tab. You’ll see the window shown in Figure 2-13.

    You’ll notice that ASP files are mapped differently than ASP.NET files. For example, .asp requests are handled by C:\[WinDir]\System32\inetsrv\asp.dll, while .aspx requests are handled by C:\[WinDir]\Microsoft.NET\Framework\[Version]\aspnet_isapi.dll. In other words, ASP.NET doesn’t replace ASP. Instead, it runs alongside it, allowing ASP requests to be handled by the existing asp.dll, and providing a new aspnet_isapi.dll for ASP.NET page requests. This design allows both types of applications to be hosted on the same web server with no potential conflict (and little possible integration). You could also use a similar approach to make sure that .aspx page requests in one virtual directory are handled by a different version of the ASP.NET service than requests in another virtual directory. If a file type isn’t mapped (like .html), its contents are sent directly to the user as plain text, without any processing.


    Figure 2-13.  File mappings

    If you’re only working with a single version of ASP.NET, you probably won’t need to worry about file mapping. One reason that you might want to work with file mapping is to explicitly remove file mappings you don’t need or mappings that could be a security risk. In other cases, you might want to add a file mapping. For example, you could specify that the ASP.NET service will handle any requests for GIF images by adding a mapping for the .gif file type that points to the aspnet_isapi.dll file. This would allow you to use ASP.NET security services and logging for GIF file requests. (Note that this sort of change can slow down performance for GIF requests, because these requests will need to trickle through more layers on the server.) ASP.NET uses this technique to improve security with configuration and source code files. ASP.NET is registered to handle all requests for .config, .cs, and .vb files so that it can explicitly deny these requests, regardless of the IIS security settings.


    CAUTION 
    You should never remove any of the ASP.NET file type mappings! If you remove the .aspx or .asmx file types, web pages and web service won’t work. Instead of being processed by the ASP.NET service, the raw file will be sent directly to the browser. If you remove other files types like .vb or .config, you’ll compromise security. ASP.NET will no longer process requests for these types of files, which means that malicious users will be able to request them through IIS and inspect the code and configuration information for your web application.

    Adding a Virtual Directory to Your Neighborhood

    Working with a web application can sometimes be a little awkward. If you use Windows Explorer and look at the physical directory for the website, you can see the full list of files, but you can’t execute any of them directly. On the other hand, if you use your browser and go through the virtual directory, you can run any page, but there’s no way to browse through a directory listing because virtual directories almost always have directory browsing permission disabled.

    While you’re developing an application you may want to circumvent this limitation. That way you can examine exactly what comprises your web application and run several different pages easily, without needing to constantly type a full file name or dart back and forth between Internet Explorer and Windows Explorer. All you need to do is enable directory browsing for your virtual directory. You can easily enable or disable this setting from the Virtual Directory Properties window.

    To make life even easier, you can add a virtual directory to the Network Neighborhood in Windows Explorer. First, open Windows Explorer. Then click Network, and double-click Add Network Place from the file list, as shown in Figure 2-14.


    Figure 2-14.  Select Add Network Place

    The Add Network Place wizard will appear. This wizard allows you to create a network folder in Windows Explorer that represents your virtual directory (see Figure 2-15). The only important piece of information you need to specify is the address for your virtual directory (such as http://MyServer/MyFolder). Don’t use the physical directory path.


    Figure 2-15.  Specify the virtual directory

    You can then choose the name that will be used for this virtual directory. Once you finish the wizard, the directory will appear in your Network Neighborhood, and you can browse through the remote files (see Figure 2-16). The interesting thing is that when you browse this directory, you’re actually receiving all the information you need over HTTP. You can also execute an ASP or ASP.NET file by double-clicking—which you can’t do directly from the physical directory.


    Figure 2-16.  The mapped virtual directory

    More ASP.NET Articles
    More By Apress Publishing


       · This article is an excerpt from the book "The Definitive Guide to SAMBA 3",...
     

    Buy this book now. This article is excerpted from chapter two of the book The Definitive Guide to SAMBA 3, written by Roderick Smith (Apress, 2004; ISBN: 1590592778). Check it out at your favorite bookstore today. Buy this book now.

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek