Remote script files are carried by Microsoft.) (1)

Source: Internet
Author: User

Documentation: remotely execute server scripts

Complex Web applications call both client scripts and server scripts. Client scripts are often used to program user interfaces of applications-for example, to dynamically change Web page text and respond to user actions, such as double-clicking, perform customer-oriented tasks such as verification. The client script is executed locally in the browser, which provides users with a vivid and responsive interface.

In contrast, server scripts are used to program the last segment of an application. This often results in access to a database or execution of intermediate layer business logic. Server scripts are also used to create a large range of applications: applications that can be accessed through a variety of different types of browsers (each with different access capabilities.

However, the client and server scripts are mutually exclusive. When a request is initiated, the server may run the server script and pass the page to the browser. Then the browser can run the client script. However, if it is necessary to run the server script on the page again, the page must be submitted back to the server, and the server can run the page again effectively. Maintenance of the control status and script median on the page may involve a complicated scripting process for transferring information back and forth between the browser and the server. In addition, the return process between the customer and the server involves displaying the reload process of an application.

One compromise is remote scripting. Remote scripting allows you to work in a client script, but you need to call methods (functions or routines) on an ASP page ). In fact, users can call server scripts as they call local routines, but they still run on the server and have all access permissions to the server. Because the user never leaves the current page for calling server scripts, the page status remains unchanged.

You can use remote scripting in the following tasks:

When a user continues to interact with a data input form, the data on the server is checked and verified.

Update the information on the page from the server without refreshing the screen.
How Remote Scripting works

Remote scripting is implemented as a function library. When a user wants to run a server method, the user calls these functions from the client script. When a user calls a server method, the request is passed to a proxy process that runs asynchronously in the browser (in the implementation process, the proxy is implemented as a Java applet .) This proxy process sends a request to the server that contains the ASP page for the user to call the method.

The server loads an ASP page, and a special routine on this ASP page schedules your request to the correct function. If a method returns a value, the value is sent back to the proxy process, which encapsulates it as an object-a call object-which contains the returned value and other useful information attributes.

When you call the server method in the client script, you can select one of the two methods:

Synchronize the user script to call the remote process and wait for it to return. If the user needs a remote process result before processing, it is necessary to do so.

Asynchronous User script calls a remote script and continues processing. This page is valid for user processing. If a call lasts for a long period of time, it is necessary to use Asynchronous call.
Remote Scripting Components
To implement remote scripting, in addition to the user's own client (.htm) file and server (. asp) file, the following files are also required:

Rs.htm contains the methods you need to initialize remote scripting, execute remote processes, check the status of remote calls, and obtain method results in your own. htm file.

Rs. asp contains the remote scripting of the server initiated in the. asp file, and the method to be called when appropriate functions are scheduled on your own pages.

Rsproxy. class contains the Java class file (Object Code) of the applet when the client communicates with the server page ).
These files act as the file libraries that users can use in their own files. In general, users simply include the relevant files (rs.htm or Rs. asp) into their own customer or server pages, and then follow the call method to process them. For more information, see make Remote Scripting valid on the customer page and make Remote Scripting valid on the server page.

On the user's customer page, the user references Rs.htm, which makes the method in this file effective for the user server script. The call to the Rsproxy applet is in these methods. When you create a server page, you can INCLUDE an INCLUDE statement on the server-this statement references the Rs. asp file. With Rs.htm in the customer file, this makes the required method effective on the server page.

All files must be valid on the server. Users can place them in any suitable place. However, for the user's client and server files, the path must be valid when they send requests from the server. By default, the remote scripting process assumes that these files are valid in a folder named _ ScriptLibrary outside the virtual root directory of the user server or project. If you do not place them there, pay special attention to their paths, because you need to specify them when creating the customer and server pages.

Remote Scripting and security
Remote scripting provides the same level of security as Java applet or IFrames. To ensure that remote scripting does not violate server security, users cannot pass structured data (including objects) as parameters to a server text for execution. In addition, the server on which the user calls remote scripting must be the same as the server on which the user request contains the customer page.

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.