Поделиться через


HttpRequest.FilePath Свойство

Определение

Возвращает виртуальный путь текущего запроса.

public:
 property System::String ^ FilePath { System::String ^ get(); };
public string FilePath { get; }
member this.FilePath : string
Public ReadOnly Property FilePath As String

Значение свойства

Виртуальный путь текущего запроса.

Примеры

В следующем примере кода метод используется HtmlEncode для html-кодирования значения FilePath свойства и WriteLine метода для записи закодированного значения в файл. Этот пример кода является частью более крупного примера, предоставленного для HttpRequest класса.

// Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(DateTime.Now.ToString()));
sw.WriteLine(Server.HtmlEncode(Request.CurrentExecutionFilePath));
sw.WriteLine(Server.HtmlEncode(Request.ApplicationPath));
sw.WriteLine(Server.HtmlEncode(Request.FilePath));
sw.WriteLine(Server.HtmlEncode(Request.Path));
' Write request information to the file with HTML encoding.
sw.WriteLine(Server.HtmlEncode(DateTime.Now.ToString()))
sw.WriteLine(Server.HtmlEncode(Request.CurrentExecutionFilePath))
sw.WriteLine(Server.HtmlEncode(Request.ApplicationPath))
sw.WriteLine(Server.HtmlEncode(Request.FilePath))
sw.WriteLine(Server.HtmlEncode(Request.Path))

Комментарии

Свойство FilePath не включает PathInfo трейлер. Например, для URL-адреса http://www.contoso.com/virdir/page.html/tailFilePath значение равно /virdir/page.html.

Применяется к

См. также раздел