ASP.NET
  Home arrow ASP.NET arrow Page 5 - Introducing ASP.NET
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

Introducing ASP.NET
By: Apress Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 34
    2005-05-12

    Table of Contents:
  • Introducing ASP.NET
  • ASP.NET - Related Internet Concepts
  • Active Server Pages .NET
  • Creating an ASP.NET Web Site
  • Configuring the ASP.NET Web Site

  • 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


    Introducing ASP.NET - Configuring the ASP.NET Web Site


    (Page 5 of 5 )

    Almost all aspects of .NET, and by extension ASP.NET, can be customized via XML configuration files. These are readable (but not writeable) from .NET applications, so you can extend their applicability by defining custom configuration sections and parameters.

    For an ASP.NET web site, configuration is achieved by placing a file with the correct syntax, named web.config, at the web site directory. You can add more web.config files in child directories that you want to configure more specifically. For example, if you wanted to deny access to only a certain part of your web site, your web.config file might contain

    <configuration>
     
    <system.web>
       
    <authorization>
         
    <allow roles="Admins"/>
         
    <deny users="*"/>
       
    </authorization>
      </system.web>
    </configuration>

    This example allows access to all members of the Admins role and denies access to all other users unless modified by other web.config files.

    There are many other sections in a configuration file, and it is more efficient to refer you to the Microsoft documentation at http://msdn.microsoft.com/library/default.asp?
    url=/library/en-us/cpgenref/html/gngrfaspnetconfigura-
    tionsectionschema.asp
    than try to cover them all here. We will discuss only the most important section from the point of view of web developers, <browserCaps>.

    The <browserCaps> section controls the settings of the browser capabilities class, System.Web.HttpBrowserCapabilities. It is contained directly within the <system.web> section.

    <configuration>
      <system.web>
        <browserCaps>

    For example, the following sample web.config demonstrates parsing the USER_AGENT HTTP header for the platform type. It uses a regular expression to match portions of text of the user agent string with known systems. If you have used ASP before, you will recognize that the file specifies name/value pairs in the form of assignment statements, similar to the IIS browscap.ini files. For example, the line platform=WinNT sets the value of the platform field to the string WinNT.

    <configuration>
    <system.web>
    <browserCaps>
        <result type="System.Web.HttpBrowserCapabilities, System.Web"/>
        
    <use var="HTTP_USER_AGENT"/>
            browser=Unknown
            version=0.0
            majorver=0
            minorver=0
            frames=false
            tables=false
       
    <filter>
          <case match="Windows 98|Win98">
             
    platform=Win98
          </case>
          <case match="Windows NT|WinNT">
           
    platform=WinNT
          </case>
       
    </filter>
    </browserCaps>
    </system.web>
    </configuration>

    Within the ASP.NET page’s code, we could also examine the value of the variables platform, browser, version, and so on, and make decisions regarding the content we display.

    If Request.Browser.Platform="Win95" Then
    Response.Write("Your platform cannot host .NET applications<BR>")
    End If

    By this point you might be getting impatient to see more ASP.NET code. The next chapter is full of it!

    Summary

    We covered a lot of theory and concepts in this chapter. It is time to look at some practical examples of applying ASP.NET technology using Dreamweaver to solve everyday web programming problems. In the meantime, if you would like to see who can start hosting your ASP.NET web sites, take a look at http://www.asp.net/Default.aspx?tabindex=8&tabid=40, where you will also find links to various ASP.NET community sites.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    Buy this book now. This article is excerpted from chapter three of the book ASP.NET Web Development with Macromedia Dreamweaver MX, written by Costas Hadjisotiriou et al. (Apress, 2004; ISBN: 1590593480). Check it out at your favorite bookstore.  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 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek