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 :
- Request
- Response
- Server
- Application
And following important managing Classes for:
- Web server and Client browser related information retrival
- Configuring page caching
- Tracing implementation
- 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.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if ( string.IsNullOrEmpty(Request.QueryString["queryStringName"]) )
{
if (Convert.ToString(Request.QueryString["queryStringName"]).Equals( "queryValue" ) )
{
// do this
// and do that
Response.Write("Response is built-in object under Syste.Web namespace.");
}
}
}
}
}
}