Data Transfer

In the real web application, we need to transfer request along with user submitted data to other pages, also we need to transfer data between pages, even different web sites.

To make such operation easy, The WebRainbow v1.2 and up has enhanced Redirect mechanism:

  1. AddUrlData was introduced. It lets you easily put one pair of data in name=value format into transferring request without knowing of detailed format requirement.

  2. SetUrlTransfer as well as 4 pre-defined constants were added too. It tells WebRainbow how to deal with user submitted Form Data, as well as those new data added through AddUrlData.

For example, after the request has been processed by the first page, you want to pass the handle, along with the original form data as well as a new data generated by the first page, to the second page, you just first call

     AddUrlData ( "new_data_name", "new_data_value")

and

     SetUrlTransfer ( rdWithAllData )

then call

     Redirect ( "http://other_site_name/2nd_page )

Thus, the original form data plus new data are trasferring to the second page now. It's so easy!

Limitation: The size of transferred data is varied by different browsers and web servers.

As the demonstration for this data transfer mechanism, we divided the sample program AccessDB into two pieces, one program, RedirS, is used to handle User Login / Register request, then routes to second program RedirR, to handle User Information Entry / Modification.

Note:

  1. The VB source code is only for Visual Basic 6 & 5, because it uses ADO.

  2. This sample still keeps static sections separated from dynamic section (this is not required, just we think it may be convenient for coding and developing):

To compile first program, RedirS, follow the steps list bellow:

  1. Start Visual Basic

  2. Select Standard EXE as project type

  3. Select Sub Main as Startup Object

  4. Give RedirS as project name

  5. Set reference to WRHttpB.tlb, WRMimeB.tlb, WRnbwB.tlb, and ADO Object, same as AccessDB :

  6. Remove Form1, which is the default form for new VB project

  7. Add RedirS.bas into the Project RedirS. This file is normally in the folder
         C:\Program Files\WebRainbow\demo\redirdt\send\
    if you did not change the installation directory for WebRainbow.

  8. Compile it to RedirS.exe.

To compile second program, RedirR, follow the steps list bellow:

  1. Start Visual Basic

  2. Select Standard EXE as project type

  3. Select Sub Main as Startup Object

  4. Give RedirR as project name

  5. Set reference to WRHttpB.tlb, WRMimeB.tlb, WRnbwB.tlb, and ADO Object, same as AccessDB:

  6. Remove Form1, which is the default form for new VB project

  7. Add RedirR.bas into the Project RedirS. This file is normally in the folder
         C:\Program Files\WebRainbow\demo\redirdt\receive\
    if you did not change the installation directory for WebRainbow.

  8. Compile it to RedirR.exe.

To create an Access Database, follow these steps:

  1. If you did not change the installation directory for WebRainbow, in the folder
         C:\Program Files\WebRainbow\demo\accessdb\
    there should be these three files:
    • survey.txt
    • country.txt
    • comp_lang.txt.

  2. File survey.txt is the database structure for survey.mdb, please use the table name, field name defined in this file to create an Access database survey.mdb.

  3. Import data to tables country and comp_lang from country.txt and comp_lang.txt.
    Note: The first line of these two files is field name, it should not be imported to survey.mdb.

  4. Leave tables "users" and "users_backup" empty.

To debug

click on Debug in VB IDE for detailed instruction.

To run this sample, click on the following link for instruction of


For the latest information on WebRainbow, please see:
http://www.dmfsys.com/wrainbow/

For questions / comments please email to:
support@dmfsys.com


Copyright © 2000 - 2005, D.M.F. Systems, Corporation. All rights reserved.

Last modified on March 2, 2005