DekGenius.com
[ Team LiB ] Previous Section Next Section

Chapter 18. The HttpServerUtility Class

The HttpServerUtility class is ASP.NET's replacement for ASP's intrinsic Server object. Because the Server property of the Page class (from which all pages are derived) exposes the HttpServerUtility class instance for a given ASP.NET page, you can code to the HttpServerUtility class as you did in the Server object in classic ASP, meaning that your existing ASP code is much easier to migrate.

The HttpServerUtility class performs utility functions such as encoding and decoding strings for use in URLs or for plain-text display of content that may contain HTML markup tags. The HttpServerUtility class also provides access to limited error information and provides methods (Execute, Transfer) for modifying the execution of the current request. Table 18-1 lists the properties and methods exposed by the HttpServerUtility class.

Table 18-1. HttpServerUtility class summary

Properties

Collections

Methods (public instance)

MachineName

None

ClearError

ScriptTimeout

 

CreateObject

  

CreateObjectFromClsid

  

Execute

  

GetLastError

  

HtmlDecode

  

HtmlEncode

  

MapPath

  

Transfer

  

UrlDecode

  

UrlEncode

  

UrlPathEncode

    [ Team LiB ] Previous Section Next Section