'ASP Code' Category

Code, functions and tutorials to solve common and not-so-common problems with ASP

October 23rd, 2006

Create 'add to calendar' functionality with ASP

When running events and event registrations on a website, it's very beneficial for users to be able to add the even details to their calendars without having to manually enter them. To do this, you need to generate a .vcs file or output to send to the user. You can either generate this and return […]

October 7th, 2006

How to redirect a webpage in PHP, ASP, .Net, IIS, and .htaccess

If you've moved a domain or page, you need to redirect visitors. To transfer search engine links and ranking, you should use a 301 (HTTP code) redirect. The code "301" is interpreted by browsers and search engines as "moved permanently".
Here's how to implement URL Redirection with several web technologies:
PHP

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: […]

October 6th, 2006

Block visitors based on IP address with ASP

I previously posted this code in PHP, and I thought it would be handy to have the ASP alternative, in case you need to block visitors or known spammers based on their IP address.

Function IsBlockedIP()
        Dim UserIP
        Dim BlockedIParray(2)  ' you can create the array larger of course
  […]

October 6th, 2006

Track and display visitor count in globa.asa with ASP

It is very easy within ASP to track and display the total number of visitors to your web application. Using the global.asa file, which is automatically included and processed in each webapp, we can create some simple session variables to track visitors.

<script language="vbscript" runat="server">
 
Sub Application_OnStart
       'Set the active users to zero at the […]

October 3rd, 2006

Display directory contents with ASP

Here's a really quick way to list the files & folders in a directory with ASP. This code uses the FileSystemObject to list the files.
Obviously, you need to replace "directoryname" with your directory name. Or better yet, if you know the physical path you can replace the virtual reference via Server.MapPath("/directoryname") with the actual […]

« Previous PageNext Page »