Microsoft Knowledge Base Email Alertz

(229661) - 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...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 229661 - Last Review: August 8, 2007 - Revision: 4.3

How To Use Client-Side VBScript with Remote Scripting

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 (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:
<SCRIPT LANGUAGE="javascript">

   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");
   }

</SCRIPT>
				
Also, remove the following INPUT tags:
<br><br><input type=button name=btnRSExecuteAsynch value="RSExecute Method1 (async)" onclick="handleRSExecuteAsync()" style="width:250;height:25">
<br><br><input type=button name=btnRSGetASPObject value="aspObject = RSGetASPObject" onclick="handleRSGetAspObject()" style="width:250;height:25">
<br><br><input type=button name=btnASPObject value="aspObject.Method2 (async)" onclick="handleAspObject()" style="width:250;height:25">
<br><br><input type=button name=btnInvalidCall value="RSExecute Invalid Method3" onclick="handleInvalidCall()" style="width:250;height:25">
				
NOTE: Do not delete the first two SCRIPT tags, reproduced as follows, which are required for remote scripting:
<SCRIPT LANGUAGE="javascript" src="../rs.htm></SCRIPT>
<SCRIPT LANGUAGE="javascript">RSEnableRemoteScripting("..");</SCRIPT>
				
Then, add the following VBScript:
<SCRIPT LANGUAGE="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>
<script language="JavaScript" src="../rs.htm"></script>
<script language="JavaScript">RSEnableRemoteScripting("..");</script>
				
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.

REFERENCES

For more information about remote scripting, please see the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/library/ms950396.aspx (http://msdn2.microsoft.com/en-us/library/ms950396.aspx)

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
Keywords: 
kbcodesnippet kbhowto kbremoteprog kbscript KB229661
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate