asp.net request.servervariables[] reading _ Practical skills

Source: Internet
Author: User
Get the IP address of the client, the code is as follows:

Copy Code code as follows:

<summary>
Get Client IP Address
</summary>
<returns></returns>
public string Getclientip ()
{
String userip = request.servervariables["Http_x_forwarded_for"];
if (Userip = null)
Userip = request.servervariables["REMOTE_ADDR"];
return userip;
}

Noun Explanation: servervariables--Server variables

Request.ServerVariables ("Url")
Return to server address
Request.ServerVariables ("Path_info")
Path information provided by the client
Request.ServerVariables ("Appl_physical_path")
The physical path corresponding to the application metabase path
Request.ServerVariables ("path_translated")
Paths obtained from virtual to physical mappings
Request.ServerVariables ("Script_name")
Name of execution script
Request.ServerVariables ("Query_string")
Query string Contents
Request.ServerVariables ("Http_referer")
The requested string content
Request.ServerVariables ("Server_port")
Accept the requested server port number
Request.ServerVariables ("REMOTE_ADDR")
IP address of the remote host that made the request
Request.ServerVariables ("Remote_host")
The name of the remote host that made the request
Request.ServerVariables ("Local_addr")
Returns the server address that accepts the request
Request.ServerVariables ("Http_host")
Return to server address
Request.ServerVariables ("SERVER_NAME")
Host name, DNS address, or IP address of the server
Request.ServerVariables ("Request_method")
Methods of making requests such as, post, etc.
Request.ServerVariables ("Server_port_secure")
1 if the server port that accepts the request is a secure port, or 0
Request.ServerVariables ("Server_protocol")
The name and version of the protocol used by the server
Request.ServerVariables ("Server_software")
Name and version of the server software that answered the request and ran the gateway
Request.ServerVariables ("All_http")
All HTTP headers sent by the client, prefixed by HTTP_
Request.ServerVariables ("All_raw")
All HTTP headers sent by the client have the same result as the client sent, no prefix http_
Request.ServerVariables ("Appl_md_path")
Metabase path for the application
Request.ServerVariables ("Content_length")
The length at which the client emits content
Request.ServerVariables ("Https")
If the request crosses a secure channel (SSL), returns on if the request comes from a unsecured channel, returns off
Request.ServerVariables ("instance_id")
ID number of IIS instance
Request.ServerVariables ("Instance_meta_path")
Metabase path in response to the requested IIS instance
Request.ServerVariables ("http_accept_encoding")
Return content such as: gzip,deflate
Request.ServerVariables ("Http_accept_language")
Return content such as: en-US
Request.ServerVariables ("Http_connection")
Back to content: keep-alive
Request.ServerVariables ("Http_cookie")
Return content such as: nvisit%
2dyum=125; Aspsessionidcartqtra=fdobffabjgoecbbkhkgpfiji; Aspsessionidcaqqtsrb=lkjjplababillpcogjgamkam; Aspsessionidacrrssra=dk
Hhhfbbjojcconpphlkghpb
Request.ServerVariables ("Http_user_agent")
Return content: mozilla/4.0 (compatible; MSIE6.0; WindowsNT5.1; SV1)
Request.ServerVariables ("Https_keysize")
The number of digits of the Secure Sockets Layer connection key, such as 128
Request.ServerVariables ("Https_secretkeysize")
Server verifies the number of digits in private keywords, such as 1024
Request.ServerVariables ("Https_server_issuer")
Publisher field for server certificate
Request.ServerVariables ("Https_server_subject")
The subject field of the server certificate
Request.ServerVariables ("Auth_password")
The password the customer enters in the Password dialog box when using the Basic authentication mode
Request.ServerVariables ("Auth_type")
When a user accesses a protected script, the server is used to verify the user's authentication method
Request.ServerVariables ("Auth_User")
Name of the user on behalf of the certificate
Request.ServerVariables ("Cert_cookie")
Unique Customer Certificate ID number
Request.ServerVariables ("Cert_flag")
Customer certificate, if there is a client certificate, then BIT0 is 0 if the client certificate validation is invalid, bit1 is set to 1
Request.ServerVariables ("Cert_issuer")
Publisher field in User certificate
Request.ServerVariables ("Cert_keysize")
The number of digits of the Secure Sockets Layer connection key, such as 128
Request.ServerVariables ("Cert_secretkeysize")
Server verifies the number of digits in private keywords, such as 1024
Request.ServerVariables ("Cert_serialnumber")
Serial Number field of the client certificate
Request.ServerVariables ("Cert_server_issuer")
Publisher field for server certificate
Request.ServerVariables ("Cert_server_subject")
The subject field of the server certificate
Request.ServerVariables ("Cert_subject")
The subject field of the client certificate
Request.ServerVariables ("Content_Type")
The form or Httpput data type sent by the customer
Request.ServerVariables ("Http_x_forwarded_for")
You can get the direct IP located behind the proxy (gateway), and of course this proxy must support
Some of the request.servervariables parameters that are hidden:
Request.ServerVariables ("Number_of_processors")
Request.ServerVariables ("OS")
Request.ServerVariables ("windir")
Request.ServerVariables ("TEMP")
Request.ServerVariables ("TMP")
Request.ServerVariables ("ComSpec")
Request.ServerVariables ("Os2LibPath")
Request.ServerVariables ("Path")
Request.ServerVariables ("Pathext")
Request.ServerVariables ("Processor_architecture")
Request.ServerVariables ("Processor_identifier")
Request.ServerVariables ("Processor_level")
Request.ServerVariables ("Processor_revision")
Native Ip:<%=request.servervariables ("REMOTE_ADDR")%>
Server name: <%=request.servervariables ("SERVER_NAME")%>
Server Ip:<%=request.servervariables ("local_addr")%>
Server port: <%=request.servervariables ("Server_port")%>
Server Time:<%=now%>
IIS version: <%=request.servervariables ("Server_software")%>
Script Timeout Time:<%=server.scripttimeout%>
This file path: <%=server.mappath (Request.ServerVariables ("Script_name"))%>
Number of server CPUs: <%=request.servervariables ("Number_of_processors")%>
Server Interpreter Engine: <%=scriptengine & "/" & scriptenginemajorversion& "." &ScriptEngineMinorVersion& "." & ScriptEngineBuildVersion%>
Server operating system: <%=request.servervariables ("OS")%>
Supported File types: <%=request.servervariables ("http_accept")%>
File path to access: <%=request.servervariables ("Http_url")%>
User agent information: <%=request.servervariables ("Http_user_agent")%>

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.