Click to return to the Essentials home page    
Web Workshop  |  Essentials

<TARGET="Gobble_Gobble">


Jeff Brown
Rafael M. Muņoz
Microsoft Corporation

November 4, 1997
Updated: December 15, 1998

The following article was originally published in the Site Builder Magazine (now known as MSDN Online Voices) "Web Men Talking" column.

Contents
Target practice - Displaying form results in frames
The well-read control - Reading files with ActiveX controls
Some Perls of wisdom - Getting Perl scripts to work on PWS
Roll over Beethoven - Playing multiple .wav files
To cache or not to cache - Preventing caching

In the United States, November brings the holiday known as Thanksgiving -- the reason, no doubt, that this month's column finds the Web Men taking target practice. Turkeys of the world, beware.

The Web Men, of course, countenance no turkeys -- animal or human -- as they prowl the virtual halls in search of answers to your site-building problems. This month, besides straightening an intranet builder's aim with the <TARGET> tag when .asp files appear in the crosshairs, the guys have gone all out to assemble a cool audio demo for a site builder seeking to string .wav files together.

We give thanks every month for the Web Men.

Target practice

Dear Web Men:

I am working on developing an intranet for my department, and have been diligently trying to integrate Active Server Page (ASP) technology into the site. We are using Microsoft Windows NT 4.0 and Internet Information Server 3.0, while my development platform is Microsoft Visual InterDev. Most of the pages are built using a frame (banner, contents, main). On several of the pages, the users choose their option(s) from a list box or boxes in the left-hand frame, then click a SUBMIT button. The variables are sent to an .asp file, and based on these, I am using the response.redirect functions to load the desired page. My challenge is that I am having difficulty defining where the page is going to show up, i.e., the target. Some of the pages I want on top (TARGET="_top"... these are usually pages with their own frameset) and others I want to show up in the main frame (TARGET="main"). I can do this okay with a hyperlink using the "TARGET" tag, but can't seem to get it right with the .asp files. I've looked through tons of stuff regarding frames, but most of it deals with loading the pages via a link. Do you have any thoughts or insight into how I can resolve this?

Kevin Andersen

The Web Men reply:

Kevin, it sounds like what's preventing you from hitting the bull's eye is that you are not including a TARGET attribute in your FORM tag (where we assume your submit button is). This tells the browser which window it should use to display the results of the submitted form. It doesn't matter whether those results were built using Activer Server Pages technology, or are just on a normal HTML page.

As long as you include a NAME attribute in your FRAME tag for the main frame, you should be able to use "main," or whatever you name it, as the target for the form results. Your ASP content should get displayed there. We suggest you always target the main frame for the form results.

But what if the results are a frameset, and you want to display it in a new window? Instead of using Response.Redirect, construct and send back a page that has some client script to open the URL in a new window, as in the following example:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
    open("results.asp", "unique_window_name")
</SCRIPT>
</HEAD>
</HTML>
This puts the logic of deciding to open a new window with ASP technology on the server, since your ASP code will know what content needs to be displayed in a new window.

Back to topBack to top

The well-read control

Dear Web Men:

I am writing an ActiveX control that needs to read files from the server as well as the local (browser/client) hard disk. I am unable to find any documentation on how to "open" a file on the server versus local.

Pssssst, don't tell anyone, but I am using Delphi 3.0 from Borland to do this.

Sunil

The Web Men reply:

The proper COM way of doing this is probably to treat both local and network files as persistent data for the control. You can support and use the COM interfaces for persistence (i.e., Structured Storage and IPersist* interfaces). In particular, you may want to look at using data path properties, and check the Internet Client SDK documentation for the Data Path Properties section of COM Objects for the Internet. This might sound a little spooky, but Halloween is over -- and persistence is a topic worth studying anyway.

Another option is to use Win32 functions directly to read the files. To read local files, you can always use file functions, such as CreateFile and ReadFile. If the control is going to be used on an intranet, and the user will have access to files on the server through a LAN, you can likely use the normal Win32 functions for files on the server, too, by using a UNC path.

But if the control is going to be used on the Internet, you need to use an Internet protocol, such as HTTP or FTP, to read from files on a server. If that's the case, check out the WinInet API.

(And don’t worry, we won’t tell anyone you are using Delphi.)

Back to topBack to top

Some Perls of wisdom

Dear Web Men:

I have been having trouble using Perl scripts on both Microsoft Internet Information Server (IIS) and Microsoft Personal Web Server (PWS). I looked through the Microsoft Developer Network and could not find a simple answer to my questions about Perl scripts.

What do I need to do to get PERL scripts to run on Microsoft PWS so I can test my scripts before publishing them to the Web?

Many thanks

Chris Franz

The Web Men reply:

We attempted to get Perl scripts working on Microsoft PWS Non-MSDN Online link ourselves, and downloaded Perl for Win32 from ActiveState Tool Corp. Non-MS link

We then followed the instructions in Microsoft Knowledge Base article Q150629, Configuring and Testing a PERL Script with IIS, and it worked! Even though this article was written for IIS and Windows NT, the same information can be applied to PWS and Windows 95. One note: To run the Registry Editor on Windows 95, you run Regedit.exe, not Regedt32.exe, as the article mentions. You can get to this article and the Microsoft Knowledge Base from Support Online Non-MSDN Online link (you must register the first time you visit the site).

The folks at ActiveState have also developed something they call PerlScript, which is an ActiveX scripting engine for Perl. This means you can use Perl as your scripting language with any application on Windows that supports ActiveX scripting, such as Internet Explorer, Active Server Pages files, and the Windows Scripting Host. Not too shabby, eh?

Back to topBack to top

Roll over Beethoven

Dear Web Men:

I have been searching for an easy way to play several sound files on a page in tandem. The <EMBED...> tag doesn't seem to work, so is there an easier way?

Also, is there a simple way to create streaming format *.wav files from these sound files?

Darwin Fedorick

The Web Men reply:

Guess the new saying will be, "Roll over, Beethoven, and tell Fedorick the news!" Darwin, let us begin by saying that music on the Web should be approached with a lot of forethought and caution. We have come across sites that use music in fantastic ways. But we have also found, as we bet you have, annoying sites where the music is more a nuisance than a pleasure.

There are many ways to accomplish great music on the Web. Two technologies we particularly like are the Microsoft Interactive Music control,  Non-MSDN Online link which actually uses MIDI files, and DirectShow Non-MSDN Online link, which supports many different media types.

Back to topBack to top

To cache or not to cache

Dear Web Men:

I am looking for a solution that will minimize the problem of lost ad revenue due to page caching. I have seen references to the following solutions:

<meta http-equiv="pragma" content="no-cache">

<meta http-equiv="expires" content="0">

<meta name="expires" content="Wed, 01 Jan 1997 00:00:00 GMT">

Will any of these solutions work?

Thanks in advance for your efforts.

David Cost

The Web Men reply:

Well, David, this turned out to be a very interesting question. With pipes in hand, we donned our Sherlock Holmes hats and went out snooping for an answer. The general answer is, yes, it is possible to prevent caching; unfortunately, the ways you have listed aren't exactly best to accomplish the purpose. Indeed, a lot of folks have run across the same references, but the fact is that you must be connected to a secure site to achieve what you are looking for. For our discussion, we have provided some general information on caching and some links to information on working with secure sites. Hopefully, all of this together will get you moving in the right direction.

The term "caching" means different things to different folks. One might look at caching as the processes of a browser looking into the cache, which is a directory on your hard drive, to retrieve data when browsing the Internet. If you have recently visited a page on the Internet and you return to it, the browser can check this cache directory, and, if none of the data has changed since your last visit, can get the data from your hard drive -- thereby speeding up the access time.

With Internet Explorer  Non-MSDN Online link you have control over how the caching will work. Other browsers can handle caching a little differently, so we encourage you to refer to your preferred browser's documentation for more information. As for Internet Explorer, you can control caching in Internet Explorer 4.0 by selecting Internet Options from the View Menu; on the General Tab, under Temporary Internet Files, click the Settings Button. (In Internet Explorer 3.0, choose Options from the View Menu; click the Advanced Tab, and, under Temporary Internet Files, click the Settings Button.) You have three options, which correspond to the following processes: "Always", "Never" and "Once".

"Always" means that Internet Explorer checks the cache and, if the page is found, will check with the server to see if the page has changed. If it has, Internet Explorer gets the page from the server; otherwise, it pulls the cached copy of the page on your hard drive.

"Never" means that Internet Explorer checks the cache and, if the page is found, does not bother checking with the server; it automatically pulls your cached copy of the page.

"Once" means Internet Explorer checks the cache the first time a page is browsed during that Internet Explorer session. If the page is found, Internet Explorer checks with the server once to see if the page has changed; however, for the rest of the current session that page is handled as if the "Never" option had been set.

Another way to regard "caching" is the way in which David is referring to it above -- a way to prevent the browser from storing data, or "caching", to the hard drive. The reason one would want to do this is to prevent any type of secure data from residing on the hard drive during or after the browser session is completed.

The idea of preventing the browser from placing incoming data on the hard drive is something that is handled by both the server and client. First, the server must be set up to handle secure connections through a technology such as the Secure Socket Layer (SSL). Then you must connect to that server via "HTTPS" to initiate the secure connection. This will allow a "pragma: no-cache" header to be passed to the server, preventing data from being stored on the hard drive. You can find a wealth of information on this subject in the Security section of MSDN Online Web Workshop and at the Microsoft Security Advisor  Non-MSDN Online link site.

We should stress again that none of the <META> tags suggested will prevent data from being placed on the hard drive; this is only something for a secure connection. You should also use caution when using <META> tags because they may not always be handled as one might think. As the HTML specification RFC1866Non-MS link mentions, not all headers will work as a <META> tag:

"HTTP servers may read the content of the document <HEAD> to generate header fields corresponding to any elements defining a value for the attribute HTTP-EQUIV.

"NOTE - The method by which the server extracts document meta-information is unspecified and not mandatory. The <META> element only provides an extensible mechanism for identifying and embedding document meta-information -- how it may be used is up to the individual server implementation and the HTML user agent."

With Internet Explorer, <META> tags are processed after the data has been rendered to the hard drive, thereby defeating our purpose. For more information on this RFC and HTML specifications, see the World Wide Web Consortium  Non-MS link site.

Jeff Brown
when not forcing family and friends to listen to Zydeco and country blues music, helps develop Microsoft Mastering Series titles -- with a smile.

Rafael M. Munoz
is a part-time Adonis, and full-time support engineer for Microsoft Technical Support. He takes it very, very personally every time you flame Microsoft.


The Web Men in Short
Added November 18, 1997

Q: Boerries Wendling wants to tell the browser not to underline an anchor tag.

A: Use style sheets. The property and setting is {text-decoration: none}. See A User's Guide to Style Sheets in the Authoring section of the Web Workshop.

Q: Raymond Parsons wants to check for Internet Explorer 4.0 with Active Server Pages (ASP).

A: Detecting browser types with ASP is done through the HTTP_USER_AGENT server variable. For Internet Explorer 4.0  Non-MSDN Online link, look for the string "MSIE 4." See our answer Don't I know you?.

Q: Someone at campusclassics.com wonders how to register a Web site with search engines.

A: There are several ways. See our answer Tooting our own horn for details.

Q: Chad Strunk asks how the MSDN Online Web site implements member validation and limits site access.

A: ASP technology, with member information in a SQL Server database. Find security pointers in Mary Haggard's For Starters column #8. How to Feel Secure.

Posted November 4, 1997

Q: Michael Smith asks how to create a watermark or other background image with Dynamic HTML.

A: Set the z-index of any element on the page as negative, and place all other page elements on top of it. The element could be some text, an image, a structured graphic, and so forth. Find out more in the Positioning section of the DHTML, HTML & CSS area.

Q: Steve Fitzgerald wonders if ISPs have to support Active Server Page (ASP) files, ActiveX controls, and DHTML to view those types of content from their servers.

A: ActiveX controls and DHTML are client-side technologies and do not run on the server. ISPs need to do nothing special to support them. But ASP technology requires Microsoft Internet Information Server (IIS) 3.0.

Q: Michael Lim wants to know the purpose of the Output Window in Microsoft Visual InterDev.

A: The Visual InterDev Non-MSDN Online link application environment is used for other Microsoft Visual Tools products, such as Visual C++ Non-MSDN Online link and Visual J++Non-MSDN Online link Review the Help files for more information on how the Output Window works for each environment. For Visual InterDev, the window displays the results of a stored procedure, a precompiled collection of SQL statements, run against your Microsoft SQL Server Non-MSDN Online link or Oracle database.

Q: Jamie Krugger wants to create a button that will let visitors make his site their start page.

A: To do this you must you change some settings in the registry; please note: messing with the registry should always be handled with caution.

Right-click and select "Save Target As..." on the REG file hyperlink below to download the necessary registry file, and modify it accordingly.

DO NOT left-click, or you'll change your registry!

Okay, here it is. Remember, right-click it: REG file.

Also note that this works only with Microsoft Internet Explorer, so you should determine which browser is viewing your site and add an instruction page on how to set up a start page for the specific browser. This is how it is done on Microsoft's Internet Start Non-MSDN Online link site.

The Web Men's Greatest Hits

List of Web Men Topics

Write us!



Back to topBack to top

Did you find this article useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.