Distributed and Enterprise Samples - Web Connection Admin Page (ASP)
Web Connection Feature Demos

West Wind Web Connection

 

 

 

The following examples generate output dynamically using Visual FoxPro and Web Connection. These samples are not meant to be flashy, but to give you a functional overview of what you can do with Web Connection from simple tasks to more advanced features. If you're testing these samples on your own Web server make sure that the wcDemoMain.prg sample program is running in a Visual FoxPro session before selecting any options on this form! You can view the code for each of the routines by clicking on the [Show Code] option on the footer of each result page.

Creating HTML Forms and PDF Reports
Generating HTML Tables from Data
Cookies, Authentication, File Uploads and Email
Banners, Images, Graphs and Error Handling
Distributed, XML and Enterprise Features
West Wind Message Board
West Wind Developer Registry Sample
Interactive Photo Album Applet
POP 3 Web Mail Client Sample

Basic Functionality Demos

Simple Dynamic Request

What would any kind of development be without the Hello World request? The following link shows a dynamic request that says hello and returns server and form information from the Web server.

Hello World with Web Connection

Simple Data Query Example

The  following form is basic query that allows you to query a time and billing database by selecting a client name and date range. Output is generated as an HTML table using low level output of Response.Write(). To see a list of clients and pick one from the list click on the Client Name header button.

Client Name:

From:    To:

MultiSelect example

You can also access multiple listbox (or radio button) selections using the Request.FormMultiple() method:


Creating HTML Forms

Data Input and Interactive HTML Forms

The Guest Book application demonstrates use of interactive HTML forms using Template pages stored on disk.The template contains Visual FoxPro expressions for field names and other FoxPro expressions using Active Server like syntax. This form can take input from the user and save and update the values in a table. The page contains the table fields and several expressions to display all data without having to generate the HTML in code.

West Wind Developer Registry
Here's another, more complete example that demonstrates using templates as well as the wwBusiness Business object to create a developer registry. This example demonstrates using the business object with multiple tables, handles generic user profile management and demonstrates how to selectively allow access to certain information on a per user basis. Note profiles are accessible by email + a password which is 'password' in the demo for all profiles.  (stored in wwDevRegistry.prg)

Visual FoxPro form to IE 4.0 Dynamic HTML conversion

Note: Available only in the Enterprise Edition of Web Connection

Take most Visual FoxPro forms and run them as DHTML with very little code. You can build 90% of the form logic in Visual FoxPro and use the wwForm class to actually display the form interactively. Forms can also be repopulated dynamically and automatically from a form submission to minimize form handling code. Now supports grids (read only) and PageFrames!

Check out the Controls sample which demonstrates most of the objects the class can render. Run a Simple Data form using a customer display and list in a Page Frame view. For more comprehensive examples look at the IE 4.0 Guest applet.

Note: Grids are implemented as an VB ActiveX control. In order to be able to download this control your IE 4 security settings must be set to Medium. The control is signed and ships with full source code with the Enterprise Edition of Web Connection. If you don't already have the VB5 Runtime files, these files will be downloaded and installed automatically from the Microsoft site. Full onetime install is around 1.5 meg - the actual grid control is 14k.

Embedded HTML Example

The following example uses no Code on the Visual FoxPro end, but instead embeds Visual FoxPro code directly into the HTML page. If you're running this page under MS IIS or Commerce Builder you can also 'run' the Nocode.wc page directly by executing nocode.wc a feature automatically implemented by Web Connection via script mapping.

Client Name:

WCScript - Active Server Type Scripting with VFP code

You can also use a scripting format similar to that used by Active Server Pages, allowing you to use Visual FoxPro code instead of VBScript. The most common ASP objects are implemented as VFP objects or you can access Web Connection objects as you can in standalone programs.
Note: Unlike the .WC page scripting above, ASP scripting runs against compiled Visual FoxPro pages. You can dynamically change and debug script pages in the VFP Development version, but the runtime requires compiled pages. The admin page contains a link to compile pages.

Hello Script World
Customer Table Lookup
SQL Server Pubs Author Editor (ShowCursor and Edit Script)
Object Scripting Demo

Create Printable Documents from your VFP Reports

If you're willing to create documents that don't use HTML you can view and print VFP reports with all formatting intact in the popular Adobe Acrobat reader or plug-in. The document can be either sent back directly or be linked on a result page. The following allows you to run a customer query and return the result as a PDF document. To view this demo you must have the Adobe Acrobat reader installed:

Run PDF Report

Company to lookup:

In order to create Acrobat documents using the wwPDF class you need to have the Adobe Acrobat publishing software installed. This is Adobe's retail package of Acrobat that includes a printer driver to create PDF files. wwPDF handles dealing with the issues of printing through this driver without user intervention. Note: Adobe's IE 4.0 Acrobat implementation pluging/ActiveX control seems to be rather flaky. For best results try this demo with Netscape or IE 5.

Display Data Results in Excel and Word

You can easily output content into various Office document formats and Office will pick up these documents from HTML and transform them into their native formats. The following two demos return HTML data displayed in Word and Excel. These demos require Office 2000 or XP or later.

Return a cursor as Excel Spreadsheet  (Show Code)
Return HTML output in a Word Document (Show Code)

 

Generating HTML Tables from Data

ShowCursor Class Sample

The ShowCursor class provides a very easy mechanism to display database data in an HTML view. You can view a list view, record view or ASCII dump view. Creating these views is as easy as creating the object and calling a single method. You can customize the view by setting property values on the object.

ShowCursor's EditTable method
The EditTable method allows you to browse an edit a table interactively, much as you can in a browse. You get a list view with links to edit, add and delete items from the table. Edits are raw much like you would see in a Browse window. Note this demo takes 15 lines of code - use view code to see them...

ShowCursor against the SQL Server Pubs Database
Here's a quick example how to access a SQL Server database with Web Connection's easy SQL Passthrough wwSQL class. If you have a DSN configured for the PUBS database try this demo that displays a list of SQL Authors and allows you to edit them.
Note: You need to have a DSN named Pubs to point at the SQL Pubs sample database with a username of sa and no password. You can change these values in wwDemo::SQLShowCursor() method in wwdemo.prg.

Paged Display using the wwSession and wwShowCursor Objects

Another example showing the customer list, but this time using a paged display that shows only 5 records per page. It uses the wwSession object to capture and store the filter for the query below on each hit, then re-run the query for each of the pages to display. The user is tracked with an HTTP cookie which is used as the Session ID for the Session object.To see the full paging effect leave the query blank, then try 'A' or 'B' for short results.

Company:
   Name:
 
Cookies, Sessions, Authentication, Uploads and Email


HTTP Cookie Test

The following link assigns an HTTP Cookie with a lifetime of the Browser session. Cookies are great for keeping track of users when transactions spans multiple pages or forms. This example simply creates a Cookie and displays the value. If cookies are supported by your Browser the value should stay the same on each refresh, unless you stop and restart your browser.

Cookie Test

Session Object

The session object allows tracking users through a site to keep state between requests. Users are logged and can be timed out using an automatically managed HTTP Cookie. The Session object allows storing of dynamic variables which are persisted across requests. Data is stored in a table which can be extended to match your user tracking needs.

To check this out, run this request several times and create several variables. Then go back and change a few of the values in this form. To clear any variable leave the value blank. If you haven't done so already, run the Paged Display example above then re-run this request to see the query string stored in the session object. Each variable persists across each request and can be accessed from any Web Connection server.

Please enter your name:  

Caching

Caching with the wwCache class allows you to cache frequently generated HTML and XML fragments or other string based content to avoid having to regenerate it each time. If content is relatively static (such as certain list on your site for example) you can cache the output or the data (in XML format) with the wwCache object to avoid hitting the database and regenerate the HTML.

wwCache Example

Authentication

This link pops up an authorization dialog and forces you to log in. If the correct passwords are used you're allowed to see the page. If you visit this page again, you will not be asked for a password again, since the Authentication information is passed back by the Web server for each request once validated. You can try Guest/Guest as username/password to log in...

Authentication Test

HTTP File Uploads

Browsers support the ability to upload files over HTTP to a Web server using multi-part forms. The following form allows you to upload a file to the Web server which is stored in the server's TEMP directory. Files are uploaded as plain binary, bypassing the slow URLEncoding process both on the client and server making this an efficient way to send files to the server.



File Description:

E-Mail Sample

The following example shows off Web Connection's ability to send SMTP email using the wwServer's SendMail method, which is implemented using the wwIPStuff DLL and class library. Enter your e-mail address below and Web Connection will reply by sending you a form email message...

Enter your email address :

 

POP 3 Example using the wwSocket Class

This example lets you view the content of your POP3 mailbox. This code uses the wwPOP3 sample class which implements a  POP3 client using the low level wwSocket class.

Check your mail on your mail server

Banners, Images, Graphs and Error Handling

Rotating Banners

This link displays a different image link everytime a page is refreshed. The wwBanner class that comes with Web Connection makes this job extremely easy. For fun, add your own image reference and a link and add it on the rotation list for this sample...

Show rotating image page

Images from a database

You can also load images through Web Connection from data that is contained on disk (not likely, but you can <s>) or from a binary image stored in a memo field. The following image is loaded from a memo field image of the Web Connection badge logo GIF:

This image was loaded with <IMG SRC="wc.dll?wwDemo~ShowImage~wcdemo">.

Graphing using the wwWebGraphs class

The wwWebGraphs class is a wrapper around the Microsoft Office Web Components which can be used on the server to generate graphs on the fly. This class works with cursors by providing a table with a column for labels and additional columns for one or more data series. This example creates a cursor on the fly from the data entered here:

          

Here's a real world example that uses graphs to chart stock portfolio information using the wwWebGraphs class.

Stock Portfolio Example

Error Handling and Debugging

The following request generates an error in Visual FoxPro code. Depending on the setting of the DEBUGMODE switch in the Web Connection header file, the code error will either stop on the error line, or create an error message page and log the error to the Web connection log file. Note: The shareware version has the DEBUGMODE flag set to .t. and will always stop on the error.

Crash me!

Error handling is also provided for the dynamic page creation with ShowHTMLFile() and ShowMemoPage() which take HTML and embed FoxPro code. The following link demonstrates how errors are handled in these scripted HTML pages.

Throw an error in a scripted HTML page or run the error.wc directly.

Show Request Data on Web Page
You can also show the current request data that's being provided by the Web Server to the end of the HTML page by setting the wwProcess::lShowRequestData property to .T. You can also do this globally with a configuration switch setting in the server INI file with ShowRequestData flag.

Company:
   Name:
 

 

Distributed, Enterprise and XML Application Demos


Click here to go to the Distributed and Enterprise Sample Page