Web Q&A: Sending E-mail from Forms, Database So...

We were unable to locate this content in de-de.

Here is the same content in en-us.

This article may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. To maintain the flow of the article, we've left these URLs in the text, but disabled the links.
Web Q&A
Sending E-mail from Forms, Database Solutions, Web Site Planning
Robert Hess
Q In the May issue of MSDN® Magazine, you explained how you could submit an e-mail by using forms on the client PC. I tried to use your code and two things happened. First, no values from the form (such as name) appeared in the body of the message. Second, the e-mail wasn't sent until I hit the Send button.
      Is it possible to have the e-mail sent automatically after the user clicks OK on the warning screen? I found that if you set body=xxx, xxx will appear in the body of the message. Is this the only way to get information into the body?

A Most likely your problem is the result of the e-mail program you are using. With Outlook® or Outlook Express, you don't need to press a Send button to submit the e-mailâ€"you just respond to the warning message. Plus, all of the form's values are inserted into the message without needing to specifically assign the name "body" to one of these values. It would not be surprising to find that different e-mail programs behave differently in this regard. If you want this type of code to work with all browsers and with all combinations of browsers and e-mail programs, you'll need to do a lot of testing (for the original e-mail question, see http://msdn.microsoft.com/msdnmag/issues/0500/web/web0500.asp).

Q I forgot my password for Content Advisor, so Microsoft® Internet Explorer isn't working. What should I do?

A If you go to http://msdn.microsoft.com and enter the search string "content advisor password forgotten," it will return a search list of just a few pages that talk about password issues. In my search results, the second item in the list was a link to http://support.microsoft.com/support/kb/articles/q155/6/09.asp, which contains the following information:

SUMMARY With Content Advisor, Internet Explorer provides a way to help you control the types of content that your computer can gain access to on the Internet. After you turn on Content Advisor, only rated content that meets or exceeds your criteria can be displayed. Parents may choose to use Content Advisor to limit the content their children have access to on the Internet. If you do not know or have forgotten the Supervisor password, please contact a Microsoft Technical support professional for assistance. For information about how to contact a Microsoft Technical support professional, please visit the following Microsoft Web site: http://support.microsoft.com/support/contact/default.asp

Q I have written a Visual Basic® Webclass that allows a user to enter selection criteria and download the requested data to their computer. The data is extracted from a database and written to a formatted text file before it is sent back to the client. To ensure uniqueness, the text file name is based on account number, date, and time. After I have built the text file, how do I make the download dialog appear so that the user can download the file?

A There have been a few times when I've dynamically built a data file on the server for the user to download to their system for viewing. In most cases I provide a Comma Separated Value (CSV) file so that the user can manipulate and store this information however they choose. As you've already noticed, creating a unique file name each time is the best way to circumvent the data caching that the browser would ordinarily do to ensure that the downloaded data is fresh. If you know that the Web site will be used in an intranet scenario where both the client and the server will have file-level access to a common system, you can provide access to the data file from the file: protocol instead of using HTTP. This will bypass the browser's cache, avoiding the need to use a unique file name each time.
      Back to your question, the best way to start the download of the data is to simply present the user with a regular link to the data file you just created. Depending on the particular project, you may want to present some form of quick report summary on this page (including the size of the file download), as well as the link to the full report. In some cases a summary report based on the entered criteria may be all that the user actually needs.
      However, if you know the user will want to download the entire data report, then there are several ways to initiate the download without making the user click on yet another link. For example, once your ASP code was finished generating the report file, it could push down script code that would redirect the current browser window to the file:

response.write ("document.location = '" + filename + "'")
Or, you could open up a new window to the data report:

response.write ("window.open ('" + filename + "')")
      There are a number of other variations on this sort of thing. These options will generate a popup alert, letting the user know that a file download is pending so they can choose how to proceed.

Q I am developing a customer support Web site, but have no idea where to start. I have a list of features I want to implement, but I'm not sure which tools and technologies to use. Because the main project is a financial reporting application, I don't have much time to spend on developing the site. Here's a list of features I want to implement in addition to the usual generic Web pages and navigation:

  • Dynamic news page
  • Document repository for white-papers, user documentation, developer tips, and so on, perhaps with a search tool like the tree-control view in the MSDN library
  • Knowledge base (like support. microsoft.com)
  • Full-text search page (on the document repository and in the knowledge base)
  • Download center
      I plan to have two categories of user: my customers, who will have read-only access, and authors/administrators, who will publish and update files. Since I can't afford to do this all at once, where should I start?

A The type of Web site you are describing sounds very similar to MSDN Online. As you might expect, the MSDN Online Web site is a complex solution that uses many features of Windows® 2000, Microsoft Internet Information Services (IIS), ASP, custom designed script code, components, and database connectivity. A fairly large team is responsible for the regular publishing of this site.
      If this customer support Web site is going to be an important aspect of your business, then my recommendation would be to assemble a team of Web designers and programmers to build a custom solution. Part of this team's objectives should be to examine off-the-shelf products to see if they meet your needs. The solutions that allow you the highest level of customization are usually the most complex, and require the most development resources for design and maintenance. The solutions that put the least strain on your technical resources will usually be those that also offer the least flexibility and customizable options.
      If this will be your first attempt at building a site like this, you should expect to go through a couple of iterations before you understand exactly what your customers need and what you will be able to provide. A good starting point is to produce a quick, partially functional prototype of what you think the solution should look like using a template-oriented tool like Microsoft FrontPage®. Then, once you gather feedback from your user community you can incorporate their needs into the solution you build. Of course, the other option is to hire a company that specializes in this sort of Web design.

Q I have a GIF image of an apartment complex that was converted from a blueprint and is used as a background for a Web page. I have been asked to draw borders around each apartment in the complex. Each apartment has a varying shape. Worse yet, if the apartment is rented I have to change the color of the border to reflect that status. The rental information comes from a Microsoft Access database via ASP and VBscript. Is this plan hopeless?

A Nothing is hopeless, but some things are so difficult they may not be worth the effort. If you need to maintain the entire image as a background image for the page, then the only way to do this would be to dynamically redraw the image to reflect the current room status. If the status changes frequently, then this image would most likely need to be updated each time a page is loaded for a unique user. However, if it will change less frequently, then when a change is detected, the background image would be updated to reflect this. The actual changing of the image would need to be done by some tool that would allow you to dynamically build a GIF or JPEG image from code. Since this capability is not built into HTML or ASP you'll have to find a third-party tool.
      If you want to use a purely HTML solution, an option that comes to mind is to layer multiple <DIV>s (one on top of the other) by setting their z-order, and load different images (with transparency) into each <DIV> in order to build up a representation of the rented and unrented apartments in the complex.

Robert Hess is currently the host of "The MSDN Show" and is a regular contributor to various areas of MSDN. Send e-mail to webqa@microsoft.com.

From the August 2000 issue of MSDN Magazine.

Page view tracker