Request

Объект Request считывает HTTP запрос, отправляемый браузером на сервер.
наиболее интересные члены класса
QueryString получает коллекцию переменных строки GET запроса
Form получает коллекцию переменных метода POST
Browser имя браузера, посылающего HTTP запрос
ApplicationPath виртуальный путь к корневому каталогу на сервере
PhysicalApplicationPath физический путь к корневому каталогу на сервере
Path виртуальный путь текущей страницы
AppRelativeCurrentExecutionFilePath относительный путь текущей страницы
URL URL адрес текущего запроса
UserHostAddress IP-адрес узла удаленного клиента
UserLanguages массив языковых настроек клиента
UserAgent исходная строка пользовательского агента для клиентского браузера
RequestType метод передачи данных НТТР клиентом
HttpMethod метод передачи данных НТТР клиентом
Headers коллекция всех заголовков
Скрыть

Показать

Копировать
  Default.aspx  
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <meta charset="utf-8" />
 <title></title>
 <style>
  table {
   width: 900px;
   margin: 10px auto;
  }
  table, td{
   border-collapse: collapse;
   border: 1px solid #00F;
   font-size: 22px;
   padding: 15px;
  }
  .a {
   text-align: center;
  }
  .b {
   font-size: 17px;
  }
 </style>
</head>
<body>
 <form id="form1" runat="server">
  <div>
   <table>
    <tr>
     <td><% Response.Write("Browser"); %></td>
     <td><% Response.Write(Request.Browser.Type); %></td>
    </tr>
    <tr>
     <td><% Response.Write("ApplicationPath"); %></td>
     <td><% Response.Write(Request.ApplicationPath); %></td>
    </tr>
    <tr>
     <td><% Response.Write("PhysicalApplicationPath"); %></td>
     <td><% Response.Write(Request.PhysicalApplicationPath); %></td>
    </tr>
    <tr>
     <td><% Response.Write("Path"); %></td>
     <td><% Response.Write(Request.Path); %></td>
    </tr>
    <tr>
     <td><% Response.Write("AppRelativeCurrentExecutionFilePath"); %></td>
     <td><% Response.Write(Request.AppRelativeCurrentExecutionFilePath); %></td>
    </tr>
    <tr>
     <td><% Response.Write("URL"); %></td>
     <td><% Response.Write(Request.Url); %></td>
    </tr>
    <tr>
     <td><% Response.Write("UserHostAddress"); %></td>
     <td><% Response.Write(Request.UserHostAddress); %></td>
    </tr>
    <tr>
     <td><% Response.Write("UserHostName"); %></td>
     <td><% Response.Write(Request.UserHostName); %></td>
    </tr>
    <tr>
     <td><% Response.Write("UserLanguages"); %></td>
     <td>
      <% 
       foreach(string i in Request.UserLanguages) {
        Response.Write(i + "<br />"); 
       }
      %>
     </td>
    </tr>
    <tr>
     <td><% Response.Write("UserLanguages"); %></td>
     <!-- культура по умолчанию -->
     <td><% Response.Write(Request.UserLanguages[0]); %></td>
    </tr>
    <tr>
     <td><% Response.Write("UserAgent"); %></td>
     <td><% Response.Write(Request.UserAgent); %></td>
    </tr>
    <tr>
     <td><% Response.Write("RequestType"); %></td>
     <td><% Response.Write(Request.RequestType); %></td>
    </tr>
    <tr>
     <td class="a" colspan="2"><b><% Response.Write("Headers"); %></b></td>
    </tr>
    <tr>
     <td class="b">
      <%
       foreach(string i in Request.Headers) {
        Response.Write(i + "<br />");
       }
      %>
     </td>
     <td class="b">
      <%
       foreach(string i in Request.Headers) {
        Response.Write(Request.Headers[i] + "<br />");
       }
      %>
     </td>
    </tr>
   </table>
  </div>
 </form>
</body>
</html>