Wednesday, August 29, 2007

Server Object - HttpServerUtility


 

  • The functionality of the ASP intrinsic Server is object in ASP.net is implemented by the HttpServerUtility class
  • An instance of the type is created when ASP.net begins to process the request and is then stored as part of the request context
  • HttpServerUtility class has two properties MachineName and ScriptTimeout
  • ScriptTimeout is to get/set the time in seconds a request is allowed to process
  • Code: this.Server.ScriptTimeout = 30000;

Important methods of Server object

UrlEncode/ UrlDecode

Encodes a string (for HTTP transmission to a client) in a URL

UrlDecode decodes a string encoded for Http transmission

MapPath

Returns the physical path of a file from provided virtual path

UrlPathEncode

Encodes only path portion of the URL string

ClearError

Clears the last exception that was thrown for the request

Transfer / Execute

See below

No comments: