HttpRequest.SaveAs(String, Boolean) 方法

定义

将 HTTP 请求保存到磁盘。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)

参数

filename
String

物理驱动器路径。The physical drive path.

includeHeaders
Boolean

一个布尔值,该值指定是否应将 HTTP 头保存到磁盘。A Boolean value specifying whether an HTTP header should be saved to disk.

例外

HttpRuntimeSectionRequireRootedSaveAsPath 属性设置为 true,但 filename 不是绝对路径。The RequireRootedSaveAsPath property of the HttpRuntimeSection is set to true but filename is not an absolute path.

示例

下面的代码示例 SaveAs 在加载页面时调用方法。The following code example calls the SaveAs method when a page is loaded. 此调用指定该请求将作为文本文件保存在 ASP.NET 进程标识已被授予写入权限的目录中,并且该请求中包含的任何标头信息都包含在该文件中。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)

注解

将请求上下文保存到磁盘对于调试很有用。Saving the request context to disk can be useful in debugging.

适用于