Web Connection Admin Page (HTM) | Web Connection Admin Page (ASP)

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 wcMain.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

Web Connection Feature 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:  
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.

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 the IE 4.0 Guest applet and the multi-paged Customer Billing Sample.

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.

Show Demo Page
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. Really <s>... In IE, static links work better than direct content returned. If you try this with IE try putting values into the test box - it appears the longer the doc the worse the load problems in IE4.

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 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, File 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.

Variable Name:   Value:

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

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 :

Banners, Images, Graphs and Error Handling

Rotating Banners

Note: Available only in the Enterprise Edition of Web Connection

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">.

Simple Graphing with Internet Explorer

The wwHTML::IEChart method allows easy creation of basic graphs using the IEChart ActiveX control available from Microsoft. Fill in some numeric values to graph in the textboxes below.

          

Error Handling

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.