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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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 / 33
    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

    - Developing a Mini ASP.NET AJAX Server Centri...
    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT