Microsoft KB Archive/229661

= How To Use Client-Side VBScript with Remote Scripting =

Article ID: 229661

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Active Server Pages 4.0
 * Microsoft Internet Explorer 4.01 Service Pack 1
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer 5.5
 * Microsoft Internet Information Server 4.0
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q229661



SUMMARY
You can use client-side VBScript with remote scripting, but you may face limitations, such as limited cross-platform compatibility and call capability. Also, you may not be able to call server-side Active Server Pages (ASP) methods asynchronously using the RSExecute method or use the RSGetASPObject methods when you use client-side VBScript.

When you use client-side VBScript, your remote scripting application works with Internet Explorer version 4.01 or later. It may also work with Netscape with a VBScript plug-in.



MORE INFORMATION
This article relies on the remote scripting samples, which are available from the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/library/ms950396.aspx

In the left pane, click Remote Scripting, and then click Samples. You can then download the sample that is appropriate for the processor on your Web server. By default, the remote scripting sample will be installed in the C:\InetPub\Wwwroot\ folder. The samples include the _ScriptLibrary, which creates the _ScriptLibrary subdirectory under C:\InetPub\Wwwroot\. Within the _ScriptLibrary directory is another subdirectory named Samples, which contains the Simple.htm file.

First, make a copy of Simple.htm, and name it SimpleVBS.htm.

Using a Web page editor such as Visual InterDev, edit SimpleVBS.htm. First, delete the third SCRIPT tag and all of its contents, as shown below: 

var serverURL = "simple.asp"; var aspObject;

function myCallBack(co) {   alert("CALLBACK\n\n" +        "status = " + co.status + "\n\n" +        "message = " + co.message + "\n\n" +        "context = " + co.context + "\n\n" +        "data = " + co.data + "\n\n" +        "return_value = " + co.return_value); }

function errorCallBack(co) {   alert("ERROR_CALLBACK\n\n" +        "status = " + co.status + "\n\n" +        "message = " + co.message + "\n\n" +        "context = " + co.context + "\n\n" +        "data = " + co.data); }

function handleRSExecute {   var co = RSExecute(serverURL,"Method1"); myCallBack(co); }

function handleRSExecuteAsync {   RSExecute(serverURL,"Method1",myCallBack,"RSExecute"); }

function handleRSGetAspObject {   aspObject = RSGetASPObject(serverURL); var msg = "aspObject public_description\n"; for (name in aspObject) msg += "  " + name + "\n"; alert(msg); }

function handleAspObject {   aspObject = RSGetASPObject(serverURL); aspObject.Method2(myCallBack,errorCallBack,"aspObject"); }

function handleInvalidCall {   var co = RSExecute(serverURL,"Method3",myCallBack,errorCallBack,"Invalid RSExecute"); }

 Also, remove the following INPUT tags:     NOTE: Do not delete the first two SCRIPT tags, reproduced as follows, which are required for remote scripting:  RSEnableRemoteScripting(".."); Then, add the following VBScript: 

serverURL = "simple.asp"

function handleRSExecute

set co = RSExecute(serverURL,"Method1") msgbox("CALLBACK" & CHR(13) & CHR(13)_        & "status = " & co.status & CHR(13) & CHR(13)_         & "message = " & co.message & CHR(13) & CHR(13)_         & "context = " & co.context & CHR(13) & CHR(13)_         & "data = " & co.data & CHR(13) & CHR(13)_         & "return_value = " & co.return_value) set co = nothing

end function

  <script language="JavaScript">RSEnableRemoteScripting(".."); NOTE: It is important that you add the SCRIPT LANGUAGE="VBScript" before the first two script language="JavaScript" tags. If not, you may encounter errors.

NOTE: When you view SimpleVBS.htm in your browser and click RSExecute Method1, you should get a status = 0. If not, check to ensure that the address in your browser is a URL and not the physical file location on the Web server.

<div class="references_section">