Remote scripting - enhances ASP interactivity and improves a big tool for ASP response
One. Summary.
Remote Scripting (Requirening RS) is a technology that Microsoft uses Java Applet to expand the ASP function. RS technology gives developers' ability to combine customers and servers on the same page.
In the dynamic web domain, in the past, VBScript, JavaScript handles the user interface in the client, and do some pre-process work before submission. If you interact with the server side, you must submit the entire Form within the server. The server-side receives the submitted data to do some processing, and then returns the processing result to the client.
If RS technology is used, the client program interacts with the server can bypass the process of submitting, directly call the server-side handler, and then get the return result is displayed on the client. For example, new users in a website When registering, you often need to fill in a registration form, which will contain information such as "User Name", "Password", fill in the completion "Submit" button, this user registration information is sent to the server, the server detects "user name" Duplicate, there is a prompt error, no newly registered a user. This way the user doesn't know if the user has existed in the process of the user, and it is necessary to wait until the entire form will be obtained. RS technology can search the server-side database when the user just fills in "Username", and gets the result of repetition, prompting the user to replace the user name, so that the entire registration is successful, reducing the time to return The interactivity of the program is also improved.
RS technology can improve the response speed of the ASP program (ASP running speed is not improved), because the normal method must submit the entire form (FORM), the form not only contains the data input data, but also the client address, user browser, Screen information, etc., multiple data, then wait for the server to return processing. The RS technology has bypassed the process of form submission, directly calling the program on the server, then returning the result, which although the server is handled this piece as before However, due to the process of removing the form, the response speed is improved. Typical applications such as search, refresh, etc.
2 use Remote scripting technology
Download RS in http://msdn.microsoft.com/scripting/remotescripting/x86/rs10ben.exe (latest version 1.0b, file size 143KB), will add "Microsoft Windows Script" shortcut after installation, which contain Sample programs and detailed documents. RS is installed in a C: / INTEPUB / WWWROOT / _ScriptLibrary directory, mainly consisting of three files (rs.htm, rs.asp, rsproxy.class) Use RS with RS with RS:
Client configuration
The client configuration is performed on a page to be interactively interact with the server side, such as the user's registration of the personal information filled in the personality. Register.htm
a. Create a JavaScript block, reference the RS.htm file:
// Note the path to the rs.htm file
b. Create a function of establishing a JavaScript block and calling rs.htm RsenableScripting ():
RsenableRemotescripting (".");
/ / Must correspond to the path to rs.htm, for example: rs.htm file and current program are in the same directory,
// use rsenableremotescripting ("."),
// In the previous directory, RSENABLEREMOTEScripting ("..") If there is no success in the child // of the current program, I don't know why ;-(
script>
Basically configured to end, after completing the server-side configuration, it is necessary to write another custom code on the client according to the actual requirements.
2. Server-side configuration
The server-side configuration is made in the ASP file you want to call. For example, when the user is registered, it is submitted to Register.asp, then these configurations are in Register.asp .a. Contain rs.asp files:
b. Methods in the RS.asp file call rsdispatch ()
<% Rsdispatch%>
c. Declaration method, or an example of user registration, if the Register function in Register.asp is used to perform the actual registration process, then this method must be declared to be called by Register.htm.
VAR public_description = new constructor (); // Construction method
Function Constructionor ()
{
this.methodName = functionname; // functionname is a function in the server-side ASP file
//MethodName is the method name that simulates an object of an object of ASP file
// FunctionName must actually exist in the ASP,
//MethodName can be customized, in the client file, use // this name to call the function in the above ASP program
}
Function functionName ()
{
// Some Code.
}
script>
3. Example:
The actual usage of RS technology will be described below. This example is an ordinary user registration. The user enters the username and password in the register.htm file. Register.as is responsible for inserting the username and password into the database, if successful returns a " The information successfully registered ". Because it is an example, it is not written very perfect, just demonstrates how to use RS technology.
Note: The three files of RS.ASP, RS.HTM, RSProxy.class, RSProxy.class, register.htm, register.asp in the same directory