快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

澳门新葡亰在线视频观看:ASP.NET取用户浏览器IP地址等信息



在ASP.NET中有一个很紧张的Property叫做HttpRequest.ServerVariables,经由过程这个Property可以掏出很多用户浏览器的信息,例如IP地址等等。

例如掏出IP地址信息。

trueIP = Request.ServerVariables["REMOTE_ADDR"];

到底能掏出那些信息,和IIS办事器有关,具体可以参考IIS Server Variables

Variable

Description

ALL_HTTP

All HTTP headers sent by the client.

ALL_RAW

Retrieves all headers in raw form. The difference between ALL_RAW and ALL_HTTP is that ALL_HTTP places an HTTP_ prefix before the header name and the header name is always capitalized. In ALL_RAW the header name and values appear as they are sent by the client.

APP_POOL_ID

IIS 5.1 and earlier: This server variable is not available.

Returns the name of the application pool that is running in the IIS worker process that is handling the request.

There is also an APP_POOL_ID environment variable that is available to applications that are running in the IIS worker process.

APPL_MD_PATH

Retrieves the metabase path of the application.

APPL_PHYSICAL_PATH

Retrieves the physical path corresponding to the metabase path in APPL_MD_PATH.

AUTH_PASSWORD

The value entered in the client's authentication dialog. This variable is available only if Basic authentication is used.

AUTH_TYPE

The authentication method that the server uses to validate users when they attempt to access a protected script.

It does not mean that the user was authenticated if AUTH_TYPE contains a value and the authentication scheme is not Basic or integrated Windows authentication. The server allows authentication schemes it does not natively support because an ISAPI filter may be able to handle that particular scheme.

AUTH_USER

The name of the user as it is derived from the authorization header sent by the client, before the user name is mapped to a Windows account. This variable is no different from REMOTE_USER. If you have an authentication filter installed on your Web server that maps incoming users to accounts, use LOGON_USER to view the mapped user name.

CACHE_URL

IIS 5.1 and earlier: This server variable is not available.

For use in ISAPI applications only. Returns the unambiguous name for the current URL. It is necessary to use the Unicode version of this variable in conjunction with the kernel mode cache invalidation function to evict entries placed in the cache by HSE_REQ_VECTOR_SEND.

Note:

The server variable "UNICODE_CACHE_URL" is used in conjunction with the cache invalidation function retrieved by the HSE_REQ_GET_CACHE_INVALIDATION_CALLBACK function. This function invalidates responses cached in HTTP.SYS, whether those responses are produced by requests or by ISAPIs calling HSE_REQ_VECTOR_SEND.

CERT_COOKIE

Unique ID for the client certificate, returned as a string. This can be used as a signature for the whole client certificate.

CERT_FLAGS

bit0 is set to 1 if the client certificate is present.

bit1 is set to 1 if the certification authority of the client certificate is invalid (that is, it is not in the list of recognized certification authorities on the server).

If bit 1 of CERT_FLAGS is set to 1, indicating that the certificate is invalid, IIS version 4.0 and later will reject the certificate. Earlier versions of IIS will not reject the certificate.

CERT_ISSUER

Issuer field of the client certificate (O=MS, OU=IAS, CN=user name, C=USA).

CERT_KEYSIZE

Number of bits in the Secure Sockets Layer (SSL) connection key size. For example, 128.

CERT_SECRETKEYSIZE

Number of bits in server certificate private key. For example, 1024.

CERT_SERIALNUMBER

Serial number field of the client certificate.

CERT_SERVER_ISSUER

Issuer field of the server certificate.

CERT_SERVER_SUBJECT

Subject field of the server certificate.

CERT_SUBJECT

Subject field of the client certificate.

CONTENT_LENGTH

The length of the content as given by the client.

CONTENT_TYPE

The data type of the content. Used with queries that have attached information, such as the HTTP queries GET, POST, and PUT.

GATEWAY_INTERFACE

The revision of the CGI specification used by the server. The format is CGI/revision.

HEADER_

IIS 5.1 and earlier: This server va澳门新葡亰在线视频观看riable is not available.

The value stored in the header . Any header other than those listed in this table must be preceded by "HEADER_" in order for the ServerVariables collection to retrieve its value. This is useful for retrieving custom headers.

Note:

Unlike HTTP_, all characters in HEADER_ are interpreted as-is. For example, if you specify HEADER_MY_HEADER, the server searches for a request header named MY_HEADER.

HTTP_

The value stored in the header . Any header other than those listed in this table must be preceded by "HTTP_" in order for the ServerVariables collection to retrieve its value. This is useful for retrieving custom headers.

Note:

The server interprets any underscore (_) characters inas dashes in the actual header. For example, if you specify HTTP_MY_HEADER, the server searches for a request header named MY-HEADER.

HTTP_ACCEPT

Returns the value of the Accept header that contains a list of accepted formats, for example, "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel".

The values of the fields for the HTTP_ACCEPT variable are concatenated, and separated by a comma (,).

HTTP_ACCEPT_ENCODING

Returns a list of accepted encoding types, for example, "gzip, deflate".

HTTP_ACCEPT_LANGUAGE

Returns a string describing the language to use for displaying content.

HTTP_CONNEC澳门新葡亰在线视频观看TION

Returns a string describing the connection type, for example, "Keep-Alive".

HTTP_COOKIE

Returns the cookie string that was included with the request.

HTTP_HOST

Returns the name of the Web server. This may or may not be the same as SERVER_NAME depending on type of name resolution you are using on your Web server (IP address, host header).

HTTP_METHOD

The method used to make the request (same as REQUEST_METHOD).

HTTP_REFERER

Returns a string that contains the URL of the page that referred the request to the current page using an HTML AllowPathInfoForScriptMappings metabase property is set to true (to support exclusive CGI functionality), PATH_IN澳门新葡亰在线视频观看FO will only contain "/zip" and ISAPI applications such as ASP will break.

PATH_TRANSLATED

The physical path that maps to the virtual path in PATH_INFO, for example, "c:\inetpub\wwwroot\vdir\myisapi.dll". This variable is used by IIS during the processing of ISAPI applications.

If the AllowPathInfoForScriptMappings metabase property is set to true (to support exclusive CGI functionality), PATH_INFO will only contain "/zip" and ISAPI applications such as ASP will break.

QUERY_STRING

Query information stored in the string following the question mark (?) in the HTTP request.

REMOTE_ADDR

The IP address of the remote host that is making the request.

REMOTE_HOST

The name of the host that is making the request. If the server does not have this information, it will set REMOTE_ADDR and leave this empty.

REMOTE_PORT

The client port number of the TCP connection.

REMOTE_USER

The name of the user as it is derived from the authorization header sent by the client, before the user name is mapped to a Windows account. If you have an authentication filter installed on your Web server that maps incoming users to accounts, use LOGON_USER to view the mapped user name.

REQUEST_METH澳门新葡亰在线视频观看OD

The method used to make the request. For HTTP, this can be GET, HEAD, POST, and so on.

SCRIPT_NAME

A virtual path to the script being executed, for example, "/vdir/default.asp". This is used for self-referencing URLs.

SCRIPT_TRANSLATED

IIS 5.1 and earlier: This server variable is not available.

The canonical physical path to the script listed in SCRIPT_NAME, for example, "\\?\c:\inetpub\wwwroot\vdir\default.asp".

SERVER_NAME

The server's host name, DNS alias, or IP address as it would appear in self-referencing URLs.

SERVER_PORT

The server port number to which the request was sent.

SERVER_PORT_SECURE

A string that contains either 0 or 1. If the request is being handled on the secure port, then this is 1. Otherwise, it is 0.

SERVER_PROTOCOL

The name and revision of the request information protocol. The format is protocol/revision. (The canonicalized form of HTTP_VERSION.)

SERVER_SOFTWARE

The name and version of the server software that answers the request and runs the gateway. The format is name/version.

SSI_EXEC_DISABLED

IIS 5.1 and ea澳门新葡亰在线视频观看rlier: This server variable is not available.

Returns a 1 if the server-side include directive, #exec, is disabled. Otherwise, SSI_EXE_DISABLED returns a 0. To enable or disable #exec, use the SSIExecDisablemetabase property.

UNENCODED_URL

IIS 4.0 and earlier: This server variable is not available.

Returns the raw, unencoded URL, for example, "/vdir/default.asp?querystring".

UNICODE_

IIS 5.1 and earlier: This server variable is not available.

In unicode ISAPI applications only, it is possible to retrieve server variable values as unicode values by prepending "UNICODE_" to the name of the server variable, unless the variable starts with "HTTP_" or "HEADER_".

UNMAPPED_REMOTE_USER

The name of the user as it is derived from the authorization header sent by the client, before the user name is mapped to a Windows account (same as REMOTE_USER). If you have an authentication filter installed on your Web server that maps incoming users to accounts, use LOGON_USER to view the mapped user name.

URL

Gives the base portion of the URL, without any querystring or extra path information, for example, "/vdir/default.asp".

For the raw URL, use HTTP_URL or UNENCODED_URL.

URL_PATH_INFO

Note: This server variable is only available on IIS 5.0.

Use PATH_INFO instead.

关于取客户真个IP地址,无意偶尔候应用REMOTE_ADDR是不敷的,例如客户端颠末ADSL拨号造访Internet,那么可以借助HTTP_X_FORWARDED_FOR来掏出颠末proxy转换的地址。

假如颠末proxy转换,HTTP_X_FORWARDED_FOR掏出来是逗号分开的一串地址,掏出第一个是客户真个IP地址。

转自:http://www.cnblogs.com/procoder/archive/2010/04/16/ASP-Dot-NET-Retrieve-Browser-IP.html

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: