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!


    NEW! Best Practices: The Integrated Project and Portfolio Management Platform.

    Hear how IBM Rational Project and Portfolio Management integrated solutions help teams put the right tools and processes in place to maximize the effectiveness and efficiency of project teams and ensure that the business vision is being executed correctly. Learn how to automate and integrate requirements prioritization, top-down project planning, communications and controls, and methodology deployment to keep your scope, costs, and schedules under control. Tackle with an end-to-end approach the management of scope and scope changes, usage of methodology to control and empower project teams, and optimization of resources to align activity costs with the overall project plan.
    FREE! Go There Now!


    NEW! Applying lean thinking to the governance of software development

    Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations.
    FREE! Go There Now!


    NEW! Develop Systems Software Assets with IBM Rational Asset Manager

    Join us for this on demand webcast to learn about developing complex systems more quickly and efficiently. We'll cover market drivers for developing, governing and reusing systems software assets and how you can develop system software assets with Rational Asset Manager.
    FREE! Go There Now!


    NEW! Project and Portfolio Management Executive Resource Kit

    Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle.
    FREE! Go There Now!


    NEW! Rational 'Talks to You' Teleconference Series

    This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today!
    FREE! Go There Now!


    NEW! Rational Asset Manager eKit

    Learn how to do more with your reusable assets with the free Rational Asset Manager eKit. The eKit includes demos on how Rational Asset Manager tracks and audits your assets in order to utilize them for reuse. Plus you’ll find white papers and a Webcast that discuss the challenges of a Service Oriented Architecture and how Rational Asset Manager can provide quick and effective solutions.
    FREE! Go There Now!


    NEW! Trial download: IBM Lotus Forms V3.0

    Get a free trial download of IBM Lotus Forms V3.0 (formerly Workplace Forms), which provides a zero-footprint eForms solution to help you automate and move forms-based business processes off the desktop and onto the Web. With Lotus Forms, you can extend applications beyond the firewall by creating a single electronic form document ready for use in both thick and Web 2.0 thin client format.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Process

    Visit IBM developerWorks to try the IBM SOA Sandbox for process. The SOA Sandbox for process focuses on providing a trial environment with the necessary tooling and components required to gain a better understanding of business processes and how to best improve existing business processes to derive value quickly.
    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!


    NEW! Webcast: What is new in Viper 2 for developers?

    Viper 2 brings a great value to developer communities including SQL, XML, PHP, Ruby, .NET and Java. You probably already know that DB2 Express-C is free for developers to develop, deploy and distribute. Viper 2 provides a variety of means that help move your application from the development stage to deployment more rapidly. This webcast shows how to best utilize the latest tools available for developing DB2 applications.
    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...
    - 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...
    - Format Date/Time in a console app class





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