0 out of 5 rated this helpful - Rate this topic

HttpResponse.StatusDescription Property

Gets or sets the HTTP status string of the output returned to the client.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public string StatusDescription { get; set; }
/** @property */
public String get_StatusDescription ()

/** @property */
public void set_StatusDescription (String value)

public function get StatusDescription () : String

public function set StatusDescription (value : String)

Property Value

A string describing the status of the HTTP output returned to the client. The default value is "OK".
Exception type Condition

HttpException

StatusDescription is set after the HTTP headers have been sent.

The following code example is an ASP.NET page that uses the StreamWriter class to write the values of three HttpResponse class properties to a text file: the StatusCode property, the StatusDescription property, and the Charset property. The code first creates a constant, named INFO_DIR, that contains the path and part of the file name for the text file. A counter is then created that is used to generate unique file names for each response. Next, the code references a StreamWriter object that will write the information about the request to the file.

The code then calls the WriteLine method to write the time the response was generated, and then writes the property values to the file. The code then closes the StreamWriter object.

// Set the Charset property to the
// Central European character set.        
Response.Charset = "iso-8859-2";

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
HttpResponse.StatusDescription Property Example
This document has the wrong example; the correct example is available in the .NET Framework 3.0 and later versions of this page and is reproduced below.

The following example checks the status string of the output stream. If the status is not equal to "OK", additional code is executed.

Visual Basic

If Response.StatusDescription <> "OK" Then
'...
End If


C#

if (Response.StatusDescription != "OK")
{
// ...
}