Export (0) Print
Expand All

HttpRequest.SaveAs Method

Saves an HTTP request to disk.

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

public void SaveAs(
	string filename,
	bool includeHeaders
)

Parameters

filename
Type: System.String

The physical drive path.

includeHeaders
Type: System.Boolean

A Boolean value specifying whether an HTTP header should be saved to disk.

ExceptionCondition
HttpException

The RequireRootedSaveAsPath property of the HttpRuntimeSection is set to true but filename is not an absolute path.

Saving the request context to disk can be useful in debugging.

The following code example calls the SaveAs method when a page is loaded. The call specifies that the request be saved as a text file in a directory where the ASP.NET process identity has been granted write permissions, and that any header information included in the request is included in the file.

Request.SaveAs("c:\\temp\\HttpRequest.txt", true);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft