Image representing the Articles category

Getting a page's URL in code-behind

Published 19 years ago

You may have the need to be able to get the URL to a page in a web application from the server code. This might be because the page could move or because the URL is dynamic in some way. While this would be a nice feature to have in .NET, there are reasons it is not. We'll discuss this and a simple solution for getting a page's URL in server-side code that saves us from hard coding it in the referencing pages.

Read on ...
Image representing the Articles category

Logging Errors to the Event Log in ASP.NET Applications

Published 20 years ago

Let's face it. We're not living in a perfect world. I am not a perfect programmer, and the same probably applies to you (otherwise you would be stinkin' rich, laying on the beach somewhere drinking a Bacardi and Coke, instead of reading this article).

Because we aren't perfect, we know we are going to run into errors in the applications we write sooner or later. This article will explain how you can catch these errors in your ASP.NET applications and log them to the Windows Event log, so it's easy to review them later. The article focuses on ASP.NET, but the principle applies to other .NET applications as well.

Read on ...
Image representing the Articles category

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

Published 20 years ago

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 ...
Image representing the Articles category

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

Published 20 years ago

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 VB.NET versions of this article available.

Read on ...
Image representing the Articles category

Howto Create a Hit Counter Using a Text File in ASP.NET 1.x

Published 20 years ago

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 static variables in the Global class and in a text file using code in the Global.asax file. This article extends the ideas from a previous article where the values of the counters were just stored in static variables. By writing the counters to a file you can maintain their values, even when you restart the Web server.

There is also a Classic ASP version of this article available.

Read on ...
Image representing the Articles category

Howto Create a Hit Counter Using the Global.asax File in ASP.NET 1.x

Published 21 years ago

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 static variables using code in the Global.asax file. The disadvantage of this method is that this information is lost when you restart the Web server. Two other articles on this site demonstrate how to store this information in a text file and in a database, so the value for the counter will be preserved when you restart your Web server.

There is also a Classic ASP version of this article available

Read on ...
Image representing the Articles category

Howto Send E-mail from an ASPX Page

Published 21 years ago

This article will show you how simple it is to send an e-mail from an ASPX page. With just a few lines of code, you can add mail sending capabilities to your ASP.NET page in your website. Sample code is in C#.

Read on ...
  • «First
  • Previous
  • 1
  • Next
  • »Last

Mobile: False

Crawler: True

I: False