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:
- 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.
- 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:
- The VB source code is only for Visual Basic 6 & 5, because it uses
ADO.
- 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:
- Start Visual Basic
- Select Standard EXE as project type
- Select Sub Main as Startup Object
- Give RedirS as project name
- Set reference to WRHttpB.tlb, WRMimeB.tlb, WRnbwB.tlb, and ADO
Object, same as AccessDB :
- Remove Form1, which is the default form for new VB project
- 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.
- Compile it to RedirS.exe.
To compile second program, RedirR, follow the steps list bellow:
- Start Visual Basic
- Select Standard EXE as project type
- Select Sub Main as Startup Object
- Give RedirR as project name
- Set reference to WRHttpB.tlb, WRMimeB.tlb, WRnbwB.tlb, and ADO
Object, same as AccessDB:
- Remove Form1, which is the default form for new VB project
- 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.
- Compile it to RedirR.exe.
To create an Access Database, follow these
steps:
- 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.
- 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.
- 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.
- Leave tables "users" and "users_backup" empty.
To debug
- RedirS, the
survey.mdb should be in the same folder with
RedirS.vbp.
- RedirR, the
survey.mdb should be in the same folder with
RedirR.vbp.
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:
For questions / comments please email to:
Copyright © 2000 - 2005, D.M.F. Systems, Corporation. All rights reserved.
Last modified on March 2, 2005