ASP gets address bar URL address method

Source: Internet
Author: User
Tags servervariables server port

If you want to get an address like this: http://192.168.0.5/super/super_article.asp?id=4

So we just need to get:
192.168.0.5---><%=request.servervariables ("http_host")%><br>
/super/super_article.asp-----><%=request.servervariables ("URL")%><br>
id=4----><%=request.servervariables ("query_string")%><br>


Then we can complete the task by combining the above address:
http://192.168.0.5/super/super_article.asp?id=4----->;http://<;%=request.servervariables ("Http_host") &request. ServerVariables ("URL") & "?" &request.servervariables ("Query_string")%><br>


Use to get the file name and the passed value in the URL:
This file IP path: <%= "http://" & Request.ServerVariables ("SERVER_NAME") &request.servervariables ("Script_name")% > It's OK.
Here are some more specific ways to get server information
Several commonly used request.servervariables in Chinese
This file IP path: <%= "http://" & Request.ServerVariables ("SERVER_NAME") &request.servervariables ("Script_name")% >

<br>
Native ip:<%=request.servervariables ("remote_addr")%> <br>
Server name: <%= Request.ServerVariables ("SERVER_NAME")%> <br>
Server Ip:<%=request.servervariables ("LOCAL_ADDR")% > <BR>
Server port: <%=request.servervariables ("Server_port")%> <br>
Niuniu Base server time: <%=now% > <br>
IIS version: <%=request.servervariables ("Server_software")%> <br>
Script timeout: <%= server.scripttimeout%> <br>
This file path: <%=server.mappath (Request.ServerVariables ("SCRIPT_NAME"))%> <BR>
Server CPU Number: <%=request.servervariables ("Number_of_processors")%> <br>
Server Interpretation engine: <%= ScriptEngine & "/" & scriptenginemajorversion& "." &ScriptEngineMinorVersion& "." & scriptenginebuildversion%> <br>
Server operating system: <%=request.servervariables ("OS")%> <br>
Supported File types: <%=request.servervariables ("http_accept")%> <br>
Access file path: <%=request.servervariables (" Http_url ")%> <br&Gt
User agent information: <%=request.servervariables ("Http_user_agent")%> <br>
Gets the file name and the value passed in the URL: Request. ServerVariables ("Script_name") + "?" +request. ServerVariables ("query_string") <br>


ASP: How to get the directory where the files are located
in ASP, we all know how to get the path of the file, but the directory where the file is located does not know how to do? <br>
The path where we get the file is: <%=request.servervariables ("path_translated")%><br>
Now that we've all got the path to the file, Then we can use the function to deal with the path we just got, <br>
Here's our deal:
<%=left (Request.ServerVariables ("path_translated"), InStrRev (Request.ServerVariables ("path_translated"), "")%><br>
So what is this output? It is the directory path where you want the file. <br>

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.