Bewerken

Share via


HttpRequest.SaveAs(String, Boolean) Method

Definition

Saves an HTTP request to disk.

public:
 void SaveAs(System::String ^ filename, bool includeHeaders);
public void SaveAs (string filename, bool includeHeaders);
member this.SaveAs : string * bool -> unit
Public Sub SaveAs (filename As String, includeHeaders As Boolean)

Parameters

filename
String

The physical drive path.

includeHeaders
Boolean

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

Exceptions

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

Examples

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);
Request.SaveAs("c:\\temp\\HttpRequest.txt", True)

Remarks

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

Applies to