Servervariables set of ASP. NET (C # Development Environment) request object

Source: Internet
Author: User
Tags servervariables

Request. servervariables ["http_user_agent"] <--> return the browser type and version number.

Request. servervariables ["remote_addr"] <--> get the user's IP address

Request. servervariables ["request_method"] <--> obtain the Request Method

Request. servervariables ["local_addr"] <--> get the Server IP Address

Request. servervariables ["SERVER_NAME"] <--> get the server host name

Request. servervariables ["path_info"] <--> get the current executionProgramVirtual Path

Request. servervariables ["path_translated"] <--> obtain the absolute path of the current execution Program

Request. servervariables ["content_length"] <--> obtains the total number of characters in the content sent by the request program.

Request. servervariables ["content_type"] <--> obtain the request information type

Request. servervariables ["rgateway_interface"] <--> obtain the Gateway Interface

Request. servervariables ["QUERY_STRING"] <--> get additional URL Information

Request. servervariables ["script_name"] <--> get the file name of the current program (including the Virtual Path)

Request. servervariables ["server_port"] <--> obtain the port on which the server accepts the request.

Request. servervariables ["server_protocol"] <--> obtain the protocol and version number that the server complies.

Request. servervariables ["http_accept_language"] <--> obtain the user's language

Run the followingCodeAll values of the servervariables set can be retrieved through the calendar of the servervariables set.
Reference content
<% @ Page Language = "C #" %>
<% @ Import namespace = "system. Data" %>
<Script language = "C #" runat = "server">
Public void page_load (Object SRC, eventargs E)
{
// Obtain the servervariables variable set
Namevaluecollection servervariables = request. servervariables;

// Generate a data table. Its usage will be discussed later.
Datatable dt = new datatable ();
Datarow Dr;

DT. Columns. Add (New datacolumn ("environment variable", typeof (string )));
DT. Columns. Add (New datacolumn ("variable value", typeof (string )));

foreach (string singlevariable in servervariables)
{< br> DR = DT. newrow ();
Dr [0] = singlevariable;
Dr [1] = servervariables [singlevariable]. tostring ();
DT. rows. add (DR);
}

maid = new dataview (DT);
maid ();
}< br>





bordercolor = "black"
borderwidth = "1"
gridlines = "both"
cellpadding = "3"
cellspacing = "0"
font-name = "verdana"
font-size = "8pt"
headerstyle-backcolor = "# aaaadd "
alternatingitemstyle-backcolor =" # eeeeee "
/>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.