System.Web namespace

System.Web :

The System.Web namespace contains the important base level ingredients for ASP.NET applications. This namespace includes classes for our important primary objects.

This namespace has following built-in Objects :

1)    Request

2)    Response

3)    Server

4)    Application


And following important managing Classes for:

1)    Web server and Client browser related informaion retrival

2)    Configuring page caching

3)    Tracing implementation

4)    Cookies


System.Web namespace is an important base for Web Form user interface and web services.

 

Use of Built-in Objects like Request and Response are very common and widely used. We directly write them without creating objects as they are built-in objects.

Ex.

    1 using System;

    2 using System.Collections.Generic;

    3 using System.Linq;

    4 using System.Web;

    5 using System.Web.UI;

    6 using System.Web.UI.WebControls;

    7 

    8 namespace WebApplication1

    9 {

   10     public partial class WebForm1 : System.Web.UI.Page

   11     {

   12         protected void Page_Load(object sender, EventArgs e)

   13         {

   14             if (!IsPostBack)

   15             {

   16                 if ( string.IsNullOrEmpty(Request.QueryString["queryStringName"]) )

   17                 {

   18                     if ( Convert.ToString(Request.QueryString["queryStringName"]).Equals( "queryValue" )  )

   19                     {

   20                         // do this

   21                         // and do that

   22                         Response.Write("Response is built-in object under Syste.Web namespace.");

   23                     }

   24                 }

   25             }

   26         }

   27     }

   28 }

 

Ebook Download
View all
Learn
View all