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

No Server to Call Your Own


Jeff Brown
Rafael M. Muņoz
Microsoft Corporation

February 2, 1998
Updated: January 18, 1998

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

Contents
Do you belong in here? - Setting up a members-only area
Gonna write you a letter - Sending e-mail from ASP
Complete control is yours - Detecting browser encryption strength
Fabulous features - Using ASP without control of the server
This versus that - Subscriptions versus Channels
Time for a tune-up - Updating scripting engines

Answers are good -- especially the Web Men's -- but you can also get a T-shirt. If your question is posted in this column, the guys will send you fine MSDN Online apparel (the aforementioned tee). So send in those honest, hardworking queries to webmen@microsoft.com.

ASP this, IIS over there -- sometimes it seems as though all we hear are acronyms! The technologies are pretty exciting, but what do you do if you're holed up in a basement somewhere, posting your pages by FTP over a 14.4Kbps modem to an unseen ISP? How do you take advantage of all this stuff everyone keeps yacking about?

That's only one of the profound conundrums the Web Men unravel in February's column. They also address the true natures of channels and subscriptions, scripting engine upgrades, encryption-strength detection, members-only sites, and something else about ASP.

Remember, it's a short month. Read fast.

Do You Belong in Here?

Dear Web Men:

Most people in the IS field work on many projects at once. I am no exception. But for the first time in years I have one project and that is all I have. Well, there are five projects -- but they are all stopped on the same thing. I have five sites that all want "members-only" areas. I've done the settings with access permissions on directories, so the login box pops up on the screen. But this is not what they want. They all want the same type of system as Microsoft's MSDN Online (meaning the guest level and levels 1, 2, 3). I have come up with a way to do it, but there's got to be a better way. Using ASP pages, I can control login/logout and page access, but I cannot find a way of typing the URL to a zip file and keeping it from downloading.

So what it breaks down to is: How can I make a members-only site that controls access to both Web files and downloads without resorting to setting Windows NT permissions and creating a user account for every user on the site?

Geoff

The Web Men reply:

Geoff, it sounds like you do a lot of juggling. Wonder if the Flying Karamazov Brothers are looking for new members.

So you want to limit access to areas of your site, similar to the members-only areas of the MSDN Online? To tell you the truth, you are just a few simple steps away. You need to set up a membership database in conjunction with using Internet Information Server 4.0 (IIS) Non-MSDN Online link.

IIS 4.0 comes with many different installable components  Non-MSDN Online link for use with Active Server Pages (ASP) technology. For instance, you have the Ad Rotator component Non-MSDN Online link, (which we discussed back in Show me the money!), the Page Counter component Non-MSDN Online link, the Database Access component Non-MSDN Online link, and many more.

Take a look at the Database Access component, which allows you to connect to a database on your server. First, create a membership database; this can be done with information you already have on your members. You can even create a form-based membership registration at your site, as MSDN Online has done. Using the Database Access component, you can populate your database with new members.

Now that you have a database set up, you need to create an entry page to the members-only area of your site. Using ASP technology and the Database Access component, open a database connection and create a form for logging in. Once visitors submit their names and passwords, check the data with the database back on the server; if found and verified, allow them access beyond the logon page. If they aren't in the database, you can take them to that registration page we spoke of earlier, or continue to require them to log on.

It's as simple as that!

For more information on ASP technology and the many components available to you, read Nancy Cluts's MSDN Online Voices article So Happy Together? Using ActiveX Components with Active Server Pages. Also, download the Windows NTŪ 4.0 Option Pack Non-MSDN Online link, which contains IIS 4.0 and some great documentation. One more resource we suggest is the Microsoft Mastering Series Non-MSDN Online link. The series has a new title out, Mastering Web Site Development Using Microsoft Visual InterDev Non-MSDN Online link, which contains some great step-by-step tutorials.

Back to topBack to top

Gonna Write You a Letter

Dear Web Men:

I'm really new to Active Server Pages technology and NT. I have a good time working with the combination Apache+Perl+Unix and now I want to know how can I make a Web page with a form, and submit all the information to my e-mail address (server-side.

With Perl it is the first thing that you learn to do, with the Unix command "mail," but I haven't found a way to do this in ASP -- I mean, a "FREE" way. Thanks!

J. Mauricio Cuenca

The Web Men reply:

There is an easy way to do this from ASP in Internet Information Server (IIS) 4.0 Non-MSDN Online link, which is included as part of the Windows NT 4.0 Option Pack. You can use the Collaboration Data Objects (CDO) for NTS Library Non-MSDN Online link free of charge in ASP scripts to send and receive e-mail messages.

The following example code shows how you could use the ASP Form collection to read form fields, and send a message containing the fields using the CDO NewMail object:

<%@ LANGUAGE="VBSCRIPT"%>
<%
Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
    myMail.Send Request.Form("From"), 
  Request.Form("To"), 
    Request.Form("Subject"), 
  Request.Form("message")
Set myMail = Nothing
%>
CDO for NTS can use either the Simple Mail Transport Protocol (SMTP) Service built into IIS 4.0, or the SMTP services provided by Microsoft Exchange Server. See the Windows NT Option Pack documentation for more details about using CDO for NTS and the SMTP Service.

Back to topBack to top

Complete Control Is Yours

Dear Web Men:

I was wondering how I could detect whether a user is using a 128-bit browser, and direct that user to an appropriate page? Can this be done on the client end? The server?

Jason D. O'Grady

The Web Men reply:

Probably the best and easiest way to check the encryption strength of a browser, and redirect users, is through Microsoft Windows NT Server  Non-MSDN Online link and IIS 4.0 Non-MSDN Online link.

One of the new features offered with IIS 4.0 is complete control over server-error messages -- not only for your default server site, but individually for each virtual directory you have set up on your server. No longer do you have to put up with those cryptic server messages that not even the server manager could decipher. Now you can make your visitor's experience a more pleasurable one.

Let's look at your situation, Jason, to see how we can use this idea for your redirect needs. Should a connection fail when trying to connect to a secure site requiring a 128-bit browser, the user will receive a 403.5 error, "Security Socket Layer (SSL) 128 required." Through use of the new Management Console application, you can bring up the Properties dialog for the server and change the default settings for this error -- pointing to another location on your server and redirecting the user to your "40-bit" page.

The best part? This solution is browser-independent! With Internet Explorer 4.0 Non-MSDN Online link, there is no other way at this time to specifically detect whether a user is using the 128-bit or 40-bit version. With Netscape's browser, you can check the header information, because the encryption strength is being passed there by the browser. But we should warn you that it is possible to modify the user-agent header, so this isn't a guaranteed solution.

Back to topBack to top

Fabulous Features

Dear Web Men:

I have been trying to find information for the last few weeks, but have had very little luck. What do you do when you want to use all of the great features of IIS 3.0 and Windows NT 4.0, but you don't own the server? How can someone who normally just FTPs to their host utilize all of these great features? Specifically ASP? This really seems to be an angle that very few publications have discussed.

Any and all help is appreciated!

Jess Pugsley

The Web Men reply:

Jess, we appreciate your enthusiasm for IIS and Windows NT. First, look for an Internet Service Provider (ISP) that supports Windows NT Server Non-MSDN Online link, IIS Non-MSDN Online link and ASP. For a referral to an ISP in your area that is a Microsoft Solution Provider, go to the Obtain Services page Non-MSDN Online link on the Microsoft Web site.

If your current ISP needs more information about using or evaluating Microsoft Internet technologies, you can refer your contact to the Microsoft Internet Services Network Web site Non-MSDN Online link.

As long as you do not need to use ActiveX Server components from your ASP pages, all your ISP needs to do is give execute permission (or, in IIS 4.0, script permission) in the virtual directory containing your ASP pages. This is the same thing required to enable a client to run any server-side scripts. You would then just upload the ASP pages as you would normal HTML pages--business as usual.

If you need to use ActiveX Server components or access databases on the server, then you will likely need to work with the ISP to have those items installed and configured for you. The ISP should be willing to do it if you have a good reason, and if the ISP understands the issues involved.

Back to topBack to top

This versus That

Dear Web Men:

What is the true difference between channels and subscriptions, besides the ability to customize channels for users and have them customize them themselves?

Jane Doe

The Web Men reply:

This is a great question; just wish we knew whom to credit, Ms. Doe. You cite the main difference between channels and subscriptions -- but remember that it's not just the customization but also their content that sets the two apart.

When you subscribe to a site, you are choosing any site on the Web and doing one of two things: subscribing to a specific page, or subscribing to more than one page within the entire site. By a specific page, we mean that this is the only link in your subscription, and you can have a choice of being notified when this page has changed. To subscribe to more than one page, you choose the main page, allowing Internet Explorer 4.0 Non-MSDN Online link to cache a maximum of three pages deep into the site from that main page. The luxury of this? You can either subscribe to a site and have it updated before leaving your Internet connection, or you can set up a schedule that will download your subscription on a timely basis throughout the day. Either way, this subscription is then viewable anytime offline without requiring an Internet connection.

This is great when you know exactly what you want, and it's contained in one area on that site. It is also great for travelling; those airplane ridesgo a lot faster when you can view sections of your favorite Web site offline. But let's say your favorite site has a few different areas you like; you would have to set up individual subscriptions for each area. What if the site should change and move some of your favorite content? This is where channels come out ahead.

Channels allow a Web publisher to create content specific to each user. The publisher can create a single channel that contains the most frequently hit areas of the site, thereby requiring you to download only one channel, and not a bunch of subscriptions. Using ASP technology, the publisher can also create a dynamic channel, which you can personalize to get any pertinent content with just one update. The channel can then be displayed hierarchically, allowing you to browse swiftly through the content. Web publishers can also notify you of site changes by providing you with updated Channel Definition Format files, thereby not requiring any prior knowledge of the site, as is necessary with subscriptions.

The true difference between channels and subscriptions is content. Since not all sites have channels -- yet-- subscriptions are great and necessary, but a good Web publisher can give us so much more with a great channel. To find out more about creating channels, see George Young's in-depth articles Channels 101 and Channels 201 in the Web Workshop.

Back to topBack to top

Time for a Tune-up

Dear Web Men:

First, I must say, I really enjoy your column. It has helped me out quite a lot. But there are a few questions I haven't been able to find answers to. How can I detect the version of a client's JScript scripting engine? I recently found a neat little method in JScript 3.1 that isn't in JScript 3.0, and would like to redirect JScript 3.0 users out of the way. Also, there wouldn't happen to be a way for my page to auto-update the user's JScript 3.0 engine to Jscript 3.1, would there? For that would be truly nifty. Can you help? Thanks in advance.

Stephen Haberman

The Web Men reply:

To ensure your clients' browsers treat your JScript code like a well-oiled machine, check out the Microsoft Scripting Web site Non-MSDN Online link. There you will find a complete description of how to approach scripting engine upgrades, and the requirements for putting the Microsoft Scripting Files Logo on your page. Your clients do have to choose to upgrade their scripting engines; you cannot do it automatically. Bummer.

Below is a modified version of some sample code on the site that can be used to detect the JScript script engine version. This modified version of the code specifically checks for version 3.1 by using both the ScriptEngineMajorVersion and ScriptEngineMinorVersion functions.

<SCRIPT LANGUAGE=JavaScript>
<!-- 
// Determine the version number. 
var majorVersion;
var minorVersion; 
var requiredMajorVersion = 3;
var requiredMinorVersion = 1; 

if (typeof(ScriptEngineMajorVersion) + "" == 
  "undefined") 
    majorVersion = 1; 
    minorVersion = 0;
else
{ 
    majorVersion = ScriptEngineMajorVersion();
    minorVersion = ScriptEngineMinorVersion();
}

// Prompt client and navigate to download page. 
if ((majorVersion < requiredMajorVersion) && 
    (minorVersion < requiredMinorVersion) && 
    confirm("This page requires a newer version 
    of JScript to view. Do you want to 
        upgrade now?")) 
{ 
    location.href =
        "http://www.microsoft.com/msdownload/
           scripting.htm" 
}
--> 
</SCRIPT>

For those who wish to get the Microsoft Scripting Engines version 3.1, go to the download page Non-MSDN Online link.

Jeff Brown, when not forcing family and friends to listen to Zydeco and country blues music, helps develop training courses in the Microsoft Mastering Series -- 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 February 17, 1998

Q: Katherine Kirk asks about important issues when buying a server to start a Web company.

A: See Mary Haggard's For Starters column #2. Get Your Server Here.

Q: Dave Fleming asks which scripting language is best for DHTML programming.

A: If you are familiar with Visual Basic, use VBScript Non-MSDN Online link. If you want a more object-oriented language, and are familiar with C/C++ programming, use JScript Non-MSDN Online link. If you have an ActiveX scripting engine for another favorite language, use that.

Q: Manoj Davey asks how a Web application can store and read configuration data from the Windows registry.

A: Use the Registry Access component Non-MSDN Online link. Find more server components in the ASP Component Catalog.

Posted February 2, 1998

Q: Ronald Simon wants the FrontPage Server Administrator Command Line Version, fpsrvadm.exe, to install FrontPage extensions for his ISP customers.

A: Refer to the Microsoft Knowledge Base article FrontPage Server Administrator is slow launching Non-MSDN Online link. For more on using the Knowledge Base, see Knowledge Is Power: Inside the Microsoft KB.

Q: Robert Cezar is trying to preload a form address field using ASP. When he sets the VALUE attribute as:

<% =Addr %>
and the address has spaces in it, only the first word of the address shows.

A: Be sure your script is surrounded by quotes:

<TEXT VALUE=
"<% =Addr %>">

Q: Jodi Burt wants to create a Web site that uses a "shopping cart" and online ordering.

A: Use the StoreBuilder Wizard component of the Commerce Server, a feature of Site Sever Non-MSDN Online link. See the Microsoft Backoffice Live Non-MSDN Online link site for examples.

Q: Tom Gideon asks if you can create a DHTML scriptlet with a transparent background.

A: No, but it's being considered for the future.

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.