Document tries to download


Symptom: The Web Browser brings up a Download dialog prompting to download wc.dll or wc.exe. Sometimes this problem also causes request to return an error response such as Document contains no data or The server returned an invalid response. Typically these problems occur with older browsers or the latest versions (4.0) of Netscape.

Note: WWWC 2.70 and later adds a default header if you don't supply one!

This problem is almost always caused by a request that does not return an appropriate HTTP response back as part of the HTML response. Web Connection automatically generates HTTP headers for requests if you're using several of the wwHTML class or wwHTTPHeader class methods. However, if you entirely handcode your page using wwHTML::SendLn() these header generation functions are not called and thus no header is generated.

HTTP headers describe the content type to the browser which is required to allow the browser to display the result you return to it correctly. Some browsers don't care if there's no header and simply assume that if there's no header that the document contains HTML. However, many versions of browsers are not this lenient of the HTTP spec.

The easiest fix is to update to the latest version of Web Connection. Version 2.75 and later automatically inserts a default HTTP header if you didn't provide one. It uses the Web Server's default header by calling the ISAPI ServerSupportFunction() which adds the header. This allows maximum flexibilty, by providing for your forgetting to provide the header, but yet allowing the flexibility of adding your own. It's recommended for consistency that you always add your own HTTP headers via the generated Fox code.

An HTTP header is simply a couple of lines of text that preceed a result page. Usually you never see this header because Web Connection automatically creates and the browser removes it before displaying the page. Here's what the most basic header looks like:

HTTP/1.0 200 OK
Content-type: text/html

<HTML>

The <HTML> marks the begging of your HTML response. Note that each header is separated by a CHR(13)+CHR(10) followed by a blank line that signals the end of the HTTP header.

If you have the problems shown above you probably are not sending this header. You can check your requests in Web Connection by bringing up your Web Connection server, then clicking on the Status button. Check Save Request Files and the run the request in question. After the request was run, right click on the Save Request checkbox and click View HTML output. It should have a header similar to the above. If you don't you need to add it.

Adding a header is built into Web Connection with the wwHTML::ContentTypeHeader() method and the wwHTTPHeader. You can either call these objects/methods directly, or by using the following methods of the wwHTML class which automatically generate headers:


Last Updated: 10/03/98