Howto Create a Hit Counter Using a Database in ASP.NET 1.x with VB.NET

Posted by: Imar Spaanjaars at Tuesday, March 02, 2004 6:32:40 PM in: ASP.NET 1.x
If you have a live Web site on the World Wide Web, you may be interested in how many people are visiting your site. You can of course analyze the log files of your Web server but that information is usually difficult to read. The log files contain information for each and every request a visitor has made to your site, including resources like images, Flash movies and so on. This makes it near impossible to extract information about individual users. It would be a lot easier if you could count the number of individual users that have visited you since you started your site. It would also be useful if you could see the number of users that are currently browsing your site.

This article will show you how to accomplish these two tasks by storing the hit counters in shared variables in the Global class and in a database using code in the Global.asax file. The counters in the shared variables are used to display them on a page in your Web site; either as a counter so your visitors can see it as well, or somewhere on a page in your Admin section, so only you have access to them. By writing the counters to a database you can maintain their value even when you restart the Web server, while you still have a fast and scalable solution.

This article extends the ideas from two previous articles where the values of the counters were just stored in static variables in the Global class and in a text file.

There are also Classic ASP and ASP.NET C# versions of this article available.
Read on ...

How Do I Precompile an ASP.NET Whidbey Application?

Posted by: Imar Spaanjaars at Sunday, February 29, 2004 4:36:59 PM in: VS 2005

UPDATE (2005-12-06): The compilation features presented in this article are obsolete. It's recommended that you look at Web Deployment Projects (http://weblogs.asp.net/scottgu/archive/2005/11/10/430283.aspx) instead.

Unlike Web sites created with Visual Studio .NET 2002 or 2003, there is no need to do a full compile of the project whenever something has changed in your site. The new Code Behind feature and the Code directory used in ASP.NET Whidbey allow you to make changes without recompiling. As soon as the changed page gets requested, the .NET FRamework will recompile the page on the fly.

However, it is sometimes useful to compile the application right after you have deployed it. One reason for this precompilation is speed. Another is code protection. A compiled application does not expose its source in the ASPX pages any longer. There are two ways to compile an application at deployment time: In-place compilation and Precompilation for Deployment

Read on ...

Why Do I Receive a "The page cannot be found" Error With ASP.NET On Windows Server 2003?

Posted by: Imar Spaanjaars at Saturday, February 21, 2004 11:24:02 AM in: ASP.NET 2.0
When you have installed ASP.NET on Windows Server 2003, you may receive the following 404 - Page Not Found error:
Read on ...

Lorem ipsum dolor sit amet - Placeholder Text

Posted by: Imar Spaanjaars at Friday, February 20, 2004 10:05:37 PM in: General
Placeholder text, use to fill in blank area's in a Web site, instead of the "content goes here" thingies.

For more information, some history and a Lorum Ipsum generator, check the Lorum Ipsum Web site.
Read on ...

Display Information About a Microsoft Access Database

Posted by: Imar Spaanjaars at Thursday, February 19, 2004 3:06:04 PM in: Classic ASP

The following block of code will display the properties of ALL tables in a Microsoft Access database. For the code to run successfully, the variable MyConnectionString needs to contain a valid connection string pointing to the Access database.
With this code, all tables, including system tables are displayed. If you want to limit the list, use myTable.Type to determine the type of the table and skip the system tables. User tables will return "TABLE", while system tables will return "ACCESS TABLE".

If you want to display information about just a single table, remove the For Each loop and uncomment the line that starts with Set myTable. Don't forget the pass the name of the right table to the Tables collection.

Read on ...

Execute a Stored Procedure Without an Explicit ADO Command Object

Posted by: Imar Spaanjaars at Thursday, February 19, 2004 11:42:30 AM in: Classic ASP
The following code shows you how to execute a Stored Procedure (called MyStoredProcedure) in ASP without creating an explicit ADO Command object. The Stored Procedure expects two parameters: @FirstParam (of datatype int) and @SecondParam (of datatype varchar). Modify the parameter list to suit your requirements
Read on ...

How Do I Store and Access My Connection Strings in ASP.NET 2?

Posted by: Imar Spaanjaars at Thursday, February 19, 2004 10:13:58 AM in: ASP.NET 2.0
With ASP.NET 1.0 and 1.1 many people stored their connection strings in the Web.config file under the appSettings element. But is there a better way to save these settings in ASP.NET 2.0?
Read on ...

Howto send E-mail from an ASP page

Posted by: Imar Spaanjaars at Wednesday, February 18, 2004 8:50:30 PM in: Web General
This article will show you how simple it can be to send an e-mail from an ASP page. With just a few lines of code, you can add mail sending capabilities to your ASP page in your Web site. Notice that I put the focus on can be; depending on your network setup, this approach may be very easy, or it may require you to setup or configure your network for this code to work. See the reference section at the end of this document for more information.
Read on ...

New Site Design

Posted by: Imar Spaanjaars at Monday, February 16, 2004 8:47:32 PM in: Imar's Blogs
Over the weekend I have implemented a new site design for Imar.Spaanjaars.Com. Instead of a messy nested tables design, mainly aimed at cross-browser compatibility (supporting browsers down to 3.0 versions), the site is now based on a “transitional approach”.
Read on ...

Answers to Why Not Try Exercises for Beginning Dreamweaver MX 2004

Posted by: Imar Spaanjaars at Monday, February 16, 2004 8:41:39 PM in: Imar's Blogs
If you have the book Beginning Dreamweaver MX 2004, you're in for a little surprise: I have posted the answers to all Why Not Try exercises for the Soccer Site project on my Web site.
Read on ... 12345678910111213141516171819202122232425262728293031