ASP Code
  Home arrow ASP Code arrow Tips and Tricks using Remote Scripting by ...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

Tips and Tricks using Remote Scripting by Salim N.
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 4
    2000-08-29

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Okay this week i'm going to be covering one of the least used and arguably most useful asp trick that shipped with visual interdev.
    RemoteScripting is one of those annoying things that get installed by visual interdev in it's _ScriptLibrary. personally i hate code that gets written for me without knowing what the code actually does so i always delete those underscore folders that interdev creates.today i'm going to tell you not to delete this folder just yet, saving the remote scripting content and this sample will show why this will provide you a very nifty trick.

    Historically speaking remotescripting has been around for two years so it's not a new technology and in the future the introduction of SOAP (Simple Object Access Protocol) will phase this technology out. But for now it can be very very handy.
    in my opinion the main reason why remotescripting has never been widely used by ASP programmer is because of the fact that in it's early implementation only server side JScript could be used and heaps of people implement ASP in VBScript so it never experienced full exposure (among other reasons). okay with this in place i'll continue...

    Ever wanted to validate a primary key without actually posting a form?
    Ever wished that you can call a function on the server from your client script without  submitting?

    if you ever seeked to achieve the above and always came to the conclusion that it's just not possible in ASP then RemoteScripting is your savor, yes RemoteScripting is exactly what it's name implies. Remotescripting is a method to communicate with remote script over HTTP.

    in this article i'm going to be showing an example of calling a function in an ASP page from a client-side javascript on a HTML page. The sample will show an example of a simple function call with just a boolean return, it will also show a more advance method of calling a function on the server and passing it parameters.
    Now is a good time to state this, RemoteScripting is browser independent (yes Netscape) and with VBScript 5.X it's server class can be implemented with VBScript.

    The Sample

    #1

    On the server in a page called remote.asp i have the following function, this file will be showed later on.

    function SimpleFunction(){
    return true;
    }

    Now to demonstrate the remote in remotescripting, clicking the below button will trigger this function from this page without posting

    The code

    objTest = RSExecute("remote.asp","SimpleFunction") 
    alert(objTest.return_value);

     

     

    above is the client side javascript code that was written to call the remote function on the server, first of all Remotescripting must
    be enabled this is done by including the following code into the head of the calling page.


     <scriptlanguage="Javascript"src= "./_ScriptLibrary/rs.htm">
    </script>
    <scriptlanguage="Javascript">
    RSEnableRemoteScripting("./_ScriptLibrary");</script>

    once enabled using the RSExecute function, any remote scripting class in a asp page can have it's methods called and the result returned. The remote class can be on your server or another server providing you this service.

    #2
    Type text into the textbox belox and click the "Call Remote Function"

    The Code

    objTest = RSExecute("remote.asp","ParamFunction",document.frmRemote.txtParam.value) 
    alert(objTest.return_value);


    The second function is slightly more advance it takes parameters enter in the text box and passes them to the ParamFunction on the server. Now the function on the server can be anything you want them to be they could validate a value etc...
    so you have seen what is on the client, here's the content on the server.

    The Server Class

     

    <%@ LANGUAGE=JScript%>
    <% 
    //the remote class
    function clsRemoting()
    {
    this.SimpleFunction = _SimpleFunction;
    this.ParamFunction = _ParamFunction; 
    } 
    //the is the function that getting called
    function _SimpleFunction(){
    return true;
    }
    function _ParamFunction(strvalue){
    return ("Hi from " + Request.ServerVariables("SERVER_NAME") + 
    " this is the paramter passed " + strvalue);
    }
    var public_description = new clsRemoting();
    // Call RSDispatch to use the public_description object 
    //and make its methods available for Remote Scripting Calls
    RSDispatch(); %>
        
    

     


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    Build Forge Express demo: Enabling software delivery excellence for small and midsized businesses

    This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process.
    FREE! Go There Now!


    NEW! Discovering the value of WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Developer for System i V7.1

    Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications.
    FREE! Go There Now!


    NEW! Hello World: Monitor a simple business process using WebSphere Business Monitor V6.0.2

    This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product.
    FREE! Go There Now!


    NEW! Integrating XML into Your Enterprise Using Data Federation

    XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats.
    FREE! Go There Now!


    NEW! Section 508 of the U.S. Rehabilitation Act: Web accessibility compliance

    Because access to government information continues to be an area of concern for many U.S. citizens with disabilities, the U.S. government enacted Section 508 of the Rehabilitation Act in 2001 to ensure that government agencies create accessible Web content, enabling all citizens to access the information they need. A fully accessible Web site makes Web content accessible to all individuals, including those with disabilities, who may be accessing Web content via a variety of user agents. Common user agents include standard Web browsers, text-only browsers, assistive devices and mobile devices such as cell phones or personal digital assistants (PDAs).
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Functional Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Performance Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads.
    FREE! Go There Now!


    NEW! Webcast: Introducing the new Information Server and Solutions community: LeverageInformation

    User communities play an important role in communication and collaboration around products, solutions and other areas of special interest to members. Successful communities are able to provide the right mix of content and services to deliver a value proposition that resonates with each audience. Join Tom Inman, VP of Marketing for Information and Platform Solutions as he introduces the new LeverageINFORMATION community. During this webcast, learn about the value provided by the community and how customers and partners derive value from the community in addressing their own technical and business challenges.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek