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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    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! Calling all CC Power Users – and those that would like to be!

    Join this Rational Talks to You teleconference, featuring Paul Boustany and Mark Krasovich, to speak to the experts about becoming a Rational ClearCase power user. Get a chance to ask your questions and learn tips and tricks for using Rational ClearCase in Agile development
    FREE! Go There Now!


    NEW! Harnessing the power of SQL and Java for high performance data access

    Join this webcast to see how IBM Data Studio Developer and pureQuery can take the pain out of Java data access. uApplications developed using both Java and SQL have become a common requirement. Database connectivity using Java Database Connectivity (JDBC) to create an application is a multi-step tedious process, and tooling that covers both SQL and Java has been unavailable, until now. IBM Data Studio introduces the pureQuery platform: a high-performance, Java data access platform focused on simplifying the tasks of developing, managing, and optimizing database applications and services.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z: Architecture

    Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server.
    FREE! Go There Now!


    NEW! IBM Rational AppScan Standard Edition V7.7

    Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7.
    FREE! Go There Now!


    NEW! Info 2.0: Harnessing the power of Web 2.0 and Enterprise Mashups

    Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started.
    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! 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! Understanding Web application security challenges

    As businesses grow increasingly dependent upon Web applications, these complex entities grow more difficult to secure. Most companies equip their Web sites with firewalls, Secure Sockets Layer (SSL), and network and host security, but the majority of attacks are on applications themselves – and these technologies cannot prevent them. This paper explains what you can do to help protect your organization, and it discusses an approach for improving your organization’s Web application security.
    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...
    - 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-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway