Recommended: ASP basic tutorial: Learning the application of subprograms in ASP In ASP, you can call your own program through VBScript and other ways. Example: Calling a subroutine using VBScript How to call a subroutine written in VBScript from ASP. The following is the quoted content
After passing the proxy, since an intermediate layer is added between the client and the service, the server cannot directly obtain the client's IP, and the server-side application cannot directly return to the client through the forwarding address. However, in the HTTP_X_FORWARDED_???? information is added to the HTTP_X_FORWARDED_????. Used to track the original client IP address and the server address requested by the original client:
Here are 2 examples to illustrate the design principles of cache compatibility applications:
'For an ASP application that requires the address of the server name: do not directly refer to HTTP_HOST/SERVER_NAME, and determine whether there is HTTP_X_FORWARDED_SERVER
| The following is the quoted content: function getHostName () dim hostName as String = hostName = Request.ServerVariables(HTTP_HOST) if not isDBNull(Request.ServerVariables(HTTP_X_FORWARDED_HOST)) then if len(trim(Request.ServerVariables(HTTP_X_FORWARDED_HOST))) > 0 then hostName = Request.ServerVariables(HTTP_X_FORWARDED_HOST) end if end if return hostNmae end function |
//For a PHP application that needs to record the client IP: do not directly refer to REMOTE_ADDR, but use HTTP_X_FORWARDED_FOR.
| The following is the quoted content: function getUserIP (){ $user_ip = $_SERVER[REMOTE_ADDR]; if ($_SERVER[HTTP_X_FORWARDED_FOR]) { $user_ip = $_SERVER[HTTP_X_FORWARDED_FOR]; } } |
Note: HTTP_X_FORWARDED_FOR If you pass through multiple intermediate proxy servers, how can it be multiple addresses divided by comma? For example: 200.28.7.155, 200.10.225.77 unknown, 219.101.137.3 Therefore, in many old database designs (such as BBS) they often The field used to record the client address is set to 20 bytes, which seems too small.
I often see error messages like the following:
Microsoft JET Database Engine Error '80040e57' field is too small to accept the amount of data to be added. Try inserting or pasting less data.
/inc/char.asp, line 236
The reason is that when designing the client access address, it is best to design the IP field size of the relevant user to more than 50 bytes. Of course, the chance of passing through a proxy of more than 3 layers is also very small.
Share: Fault tolerance mechanism in ASP code Taking the most popular ASP in China as an example, I don’t know how many people think of the concept of fault tolerance when writing code. In fact, when I encounter such a thing, it is left unresolved. Why? Think about it, the original meaning was that you could tolerate mistakes by writing the following code. See Example 1-1