All articles with keyword "Other ASP"
Accessing Object Properties
If you’re using properties of objects, such as recordsets or any of the ASP objects, be sure to store the value in a variable if you’re using it multiple times....
Click for more...
Adding Comment Blocks
To remind me what I have done to an ASP file, I will add a comment block to the top of every file (after Option Explicit, of course). This comment block usually...
Click for more...
Adding Debugging Statements
If you're building an ASP application, it's often the case that you have to use statements to dump out values at various points during the run of the page. Unfo...
Click for more...
ASP Collections
Many of the objects in ASP are actually collection objects. The Cookies, QueryString, and Session objects are all collections. Unlike their Visual Basic cousin,...
Click for more...
ASP Magic Eight Ball
If you've got questions about how to do random events, take a look at this sample from CodeAve.com:
dim saying(20)
' set the variable saying with 20 di...
Click for more...
Building a List Automatically
Here's a tip sent in by Wilfred Mathews on how to build either a drop-down list or a multi-row list box by using a database query.
While using the Select...
Click for more...
CDO Library Available for Download
In several previous tips, I showed you how you could send e-mail from your web page using the NewMail object in the CDONTS library. This component has always be...
Click for more...
Changing the Global.ASA File
Ever wonder how the server handles changes to the Global.asa file while the application is running? When you save changes to the Global.asa file, the server fin...
Click for more...
Changing the URL Parameters
One of the disadvantages of using command line parameters to link to an ASP file is that the user can simply change those parameters. Depending on the applicati...
Click for more...
Changing Time for a Virtual Server
A reader who has his ASP site hosted at a virtual server farm asked me whether it’s possible to change the system date/time for just that site. Since ASP uses t...
Click for more...
Checking for Empty vs. Checking for Null
Depending on the database you're using, checking a field value may involve checking it against an empty string (two double quote characters together) or against...
Click for more...
Choosing the Right Network Library
When ADO communicates with a database it does so through a networking library. Your selection of a networking library will be determined by the data provider an...
Click for more...
Classes in VBScript
In a previous tip, I told you about the 'new' feature of being able to build classes in VBScript to better manage your data. It turns out that if you have Inter...
Click for more...
Cleaning Your SQL Data
One of the big problems people have when they are writing SQL within ASP is dealing with data supplied by users. You may have some code that looks like this:
Click for more...
Client-Side Scripting vs. Server-Side Scripting
A user asked what the differences between client and server-side scripting are. The main and most obvious difference is whether the user can see your code. Any ...
Click for more...
COM Components and Text Generation
If you’re using COM Components in your ASP applications, remember that they can do a lot of menial tasks much faster than ASP can. For instance, any sort of str...
Click for more...
Combining ASP, Excel, XML, and XSL
Here's an excellent article at ASP Today on how to combine ASP, Excel, XML/XSL to create dynamic sites:
Click for more...
Comment Your Code
One of the biggest faults of ASP programmers is that they don't comment their code. Comments make it easier for both you and other programmers to understand wha...
Click for more...
Comparing Date Values in SQL Server
If you are comparing dates within SQL Server, you may get some unexpected results if you don't remember that every date value and both date and time components ...
Click for more...
Completely Hiding your ASP Code
A reader asked if there was any way to completely hide the ASP source code, even from the IIS administrator. There are a few basic facts about ASP pages:
...
Click for more...
Concatenating Strings
When concatenating strings or string fragments, use the ampersand (&) character to do it. You can use the addition symbol; however, this has some nasty side eff...
Click for more...
Conditional Server-Side Includes
A user asked recently if it was possible to do conditional includes based on the values in his ASP code. The problem is that server-side includes are evaluated ...
Click for more...
Connecting to Access 2000
This question keeps coming up, so I’ll answer it again. To connect to an Access 2000 database, you need to use the Jet 4.0 provider with ADO/OLE DB, like so:
Click for more...
Converting Bits to Yes/No Values
In an application I have been building, I have many cases in which I need to display the value of bit fields in SQL Server to the user. Instead of showing zeroe...
Click for more...
Counting Records in a Recordset
There are a number of ways to get a record count from a recordset; however, the most efficient way is to let the database do the work for you, as shown here:
Click for more...
Create a Constants Include File
If you get tired of having to look up the built-in constant values, such as vbShortDate, all the time, create a file with all the constants in it. There is alre...
Click for more...
Creating a Dual-Purpose Page
On a site I have created for myself (http://links.northcomp.com), I show a bunch of bookmarks that are categorized in a SQL Server database. In order to adminis...
Click for more...
Creating a Java Object in ASP
ASP is one of those languages that plays well with others. If you’ve got a Java class that you want to use in ASP, you have two options, based on what you want ...
Click for more...
Creating a Page Counter
A number of readers have asked about creating page counters, so I thought I’d dump a few ideas as to how to create counters. Older style counters relied on a gr...
Click for more...
Creating a Quick Search Box
Many web sites offer search capabilities to make it easier to find the data you need. A quick and compact way to build a search box is to do like so:
Click for more...
Creating a Recordset Manually
One of the features of the ADO Recordset is that it can be created manually. Instead of creating a recordset by way of a database, you can create a recordset...
Click for more...
Creating a Recordset Manually, Revisited
One of the features of the ADO Recordset is that it can be created manually. Instead of creating a recordset by way of a database, you can create a recordset, a...
Click for more...
Creating a Registration Cookie
Many web sites I visit allow me to register and then login once and not have to login again from the same computer. This is typically done by storing a cookie o...
Click for more...
Creating a Simple Ad Rotator
Users tend to respond better to banner ads when they change. Some sites, such as Amazon.com, make a number of banners available for use by their affiliates. How...
Click for more...
Creating a WriteLine Function
In several previous tips, you learned that any code printed using Response.Write is simply streamed into the output file without any white space or newline char...
Click for more...
Creating Objects
A user asked what the difference between using an OBJECT tag and Server.CreateObject is. The difference is when the object is actually created. Server.CreateObj...
Click for more...
Creating Objects in Global.asa
Ever need to have an object around for the life of a user's session or the life of an ASP application? You could do it in the OnStart events of either the Sess...
Click for more...
Creating Stateless Pages
By default, ASP applications make use of the Session object to maintain state. This will place a cookie on the user's computer. However, many sites (including m...
Click for more...
Data Access Constants Available
Find yourself hard-coding a lot of the data access constants in your applications? If you weren't aware, there is a file called ADOVBS.INC on your server that ...
Click for more...
Database Field Dump
Ever forget what the fields are in the recordset you just queried? You can write them out as comments to your page just by looping through the Fields collection...
Click for more...
Database Performance Testing
Ever wonder how ADO stacks up with all the other database technologies out there? Take a look at this article for a complete set of test results on the various...
Click for more...
Date and Time Functions
A user asked how to use the server date/time to control access to files. The thing to remember is that any date/time functions, such as Date, Time, Now, all wor...
Click for more...
Dealing with Multiple SUBMIT Buttons
In a previous tip, you learned how multiple submit buttons are handled by ASP. An alternative method suggested by Alexander Tsibushkin uses the same control nam...
Click for more...
Dealing with the Back Button
A number of users have asked me how to stop the user from clicking the browser’s Back button. Typically, this causes problems for submitting form data and it wo...
Click for more...
Declaring Variable Data Types
VBScript doesn't have any data types other than Variant, but there's no reason you can't think of variables as having data types. If you declare the data type i...
Click for more...
Declaring Variables
Even though you don't have to, declaring variables in VBScript can help you manage your code and prevent errors. In addition, adding Option Explicit at the very...
Click for more...
Defining Functions and Subroutines
When you are creating functions and subroutines in your ASP code, remember to define the routine before calling it. This may sound strange, but remember that AS...
Click for more...
Deploying an ASP Application
I've gotten several questions lately about how to deploy an ASP application to a web server. Not that this is a best practice, but here's how I work on my own A...
Click for more...
Detecting a Secure Port
If you’re running a secure web site with IIS, you can easily verify that the user is viewing a page through a secure port. Just check the HTTP variable called S...
Click for more...
Detecting Internet Explorer
If you're building a web site that is customized based on the user's choice of browser, it's helpful to be able to determine the browser type. In general, you n...
Click for more...
Detecting Secured Connection
In a site I built recently, I only wanted the user to hit a particular page by way of a secured HTTPS connection. As I loaded the page, I used the SERVER_PORT v...
Click for more...
Determining a Database Pathname
If you are running on a virtual server system, it can be difficult to determine where your files are in the grand scheme of things. A good example of this is fi...
Click for more...
Determining How Many Records Are Affected
Using the ADO Connection object, you can use the Execute method to run queries. However, it's often helpful to know how many new records were created, updated, ...
Click for more...
Different Types of Cookies
A reader noted that in an article on MSDN two types of cookies were mentioned: Session variable cookies and Data cookies. Session variable cookies are automatic...
Click for more...
Displaying a Message Box
During debugging, it’s helpful to be able to print out values as the page is executing. I frequently do this with Response.Write statements; however, you can al...
Click for more...
Don't Nest Delimiters
If you are using include files within your ASP code, be sure to delimit any code in those files. Make the assumption that your include file should work even if ...
Click for more...
Download a New ADOVBS.INC
Andreas Kviby has created a new, complete version of ADOVBS.INC that includes all the constants through ADO 2.1. You can download this file, for free, at this U...
Click for more...
Dumping a Recordset to HTML
Here's a quick way to dump the contents of a recordset to HTML, including column headings for the table.
Click for more...
Dynamic Server-Side Includes, Revisited
In a previous tip, I talked about how you can't dynamically include a file in your ASP file, but apparently my explanation was misunderstood, so here goes again...
Click for more...
Eliminate Browser Caching
To prevent a browser from caching ASP pages, use Response.Expires to set the Expires header:
A value of 0 forces cac...
Click for more...
Eliminate Space in Tables
Ever have an HTML table that doesn't quite line up? It could be because of extra blank lines in the HTML code. It's not supposed to make a difference to HTML; ...
Click for more...
Eliminating the Top and Left Margins
By setting the leftmargin and topmargin properties of the BODY tag, you can change how much space is left on the top and left of the page. If you add the parame...
Click for more...
Embedding Double Quotes
One common thing you have to do when writing ASP is to generate links in HTML. This often involves embedding double quote characters in your printed output, lik...
Click for more...
Embedding New Lines in E-Mail
Whenever you're using an e-mail component like CDONTS.NewMail, you have to add your own line breaks when necessary. Otherwise, you're relying on the user's e-ma...
Click for more...
Encoding Your Script
Users have asked me if there is a way to secure the script in your web pages. Using the Microsoft Script Encoder, you can now do this. You can download this too...
Click for more...
Encrypting Cookie Text
If you've ever looked at cookie contents, you will see that the text is stored in plain text format. If you have a need to store sensitive information in a cook...
Click for more...
Encrypting the Query String
This article, by Derrick, demonstrates how to encrypt the information passed through the QueryString. Using the Vernam encryption technique, you can encrypt the...
Click for more...
Environment Variable Dump
Here's a quick snippet of code that will dump all the ServerVariables coming into a page. This is helpful for debugging pages that use these variables frequentl...
Click for more...
Expiring Cookies
If you are creating a cookie, be sure to set the Expires property of the cookie. If you don't, the cookie will disappear after the user closes the browser. Here...
Click for more...
File Operations in ASP
If you need to read or write to or from a file from within your ASP application, you can do this with the FileSystemObject. This series of objects wraps the mos...
Click for more...
FileSystemObject Constants
If you want to use the constants used with the FileSystemObject family, you can reference the DLL as a METADATA tag at the top of your file:
<!-- MET...
Click for more...
Finding Infinite Loops
If you ever have a page that just seems to hang, it's possible that you have an infinite loop. This often comes up when dealing with databases, where you might ...
Click for more...
Finding OLE DB Providers
When you're using ADO, you have to use an OLE DB provider to access the database. If you're using a database that doesn't have an OLE DB provider for it, you ca...
Click for more...
Finding Out Where the User Came From
In web traffic analysis, it's helpful to find out how users found your site, especially if the user came from a link on another page. A reader asked how to get ...
Click for more...
Flexible Client-Side Validation
The ASPToday site has a good article on creating flexible, client-side, Javascript-based validation for your web pages. Here’s the URL:
Click for more...
Form Submission Limits
A question I've gotten a few times recently deals with the limit on the amount of data that can be submitted via a form. This depends on the method you're using...
Click for more...
Form Tags and Netscape
Users who have worked with Netscape may have run into this problem before, but all form tags in Netscape have to be surrounded inside a tag for them to a...
Click for more...
FormatCurrency Uses Local Settings
When using the FormatCurrency function, remember that it uses the server's settings for which symbols to display – not the user's settings. This is actually a g...
Click for more...
Formatting Dates
One quirk about VBScript is that it doesn't include a particularly good format function, like the one included with Visual Basic. For instance, when you format ...
Click for more...
Functions Don't Have Return Types
If you're a VB programmer, one of the hardest things to get used to is to not provide a return type for your VBScript functions, as you might do in VB as follow...
Click for more...
Getting Browser Capabilities
Alexander Tsibushkin called my attention to another object that is available to determine browser capabilities. The MSWC.BrowserType object provides quite a bit...
Click for more...
Getting Browser Capabilities
In response to a previous tip about getting browser capabilities, B. Campbell provides this extra information:
The Browscap.ini file must be updated on the s...
Click for more...
Getting Information from External Web Sites
Ever want to include information like stock quotes or headlines on your web site? In this article at the FourGuysFromRolla web site, you can see how to use the...
Click for more...
Getting Newly Created Record ID
In an application I was building, I needed to get back the unique ID value generated by SQL Server after I inserted the record. The problem is that in a busy sy...
Click for more...
Getting NT User/Group Information
If you need to retrieve information about the NT user or group for the current user, you could write your own server component, or you could purchase a product ...
Click for more...
Getting the End of a String
The Mid function can be used to retrieve the end of a string without having to do any calculations. If you want to retrieve the string from the 8th character to...
Click for more...
Getting the Page Name
I try to avoid hard-coding page names in my ASP code as much as I can. Files get merged and renamed, and suddenly you've got a bunch of code that doesn't match ...
Click for more...
Getting the Previous Page with HTTP_REFERER
A number of people have reminded me that there is a bug in IE that causes the HTTP_REFERER variable not to fill properly in certain cases. This means that if yo...
Click for more...
Getting to your Editor Quickly
If you're like me, you don't always want to wait for Visual InterDev to start. Since ASP files are just text, there's nothing wrong with using "Visual" Notepad ...
Click for more...
Global.asa Not Required
If you're building ASP files and not using any Application or Session events, you don't need to create a global.asa file in your directory. As was stated in a p...
Click for more...
Handling Multiselect HTML Lists
If you've created a SELECT list that is able to have more than one item selected, those items will show up comma-separated in the Request.Form collection. You c...
Click for more...
Handling Multiselect Lists
When using a select list that will allow multiple selections, the selections will be provided to you in the Request object as a comma-separated list. Using the ...
Click for more...
Hardcoding Page Names
If you're building a multi-page ASP application, you're often going to need to transfer the flow from one page to another. A handy thing I do is define all the ...
Click for more...
Header Errors with Redirect Method
A common problem in using Response.Redirect is an error indicating that header modifications must be made before writing page content. The reason for this is th...
Click for more...
How to Use SSL
Wondering about security on your web site? Read the article at ASPToday.com that discusses how and when to use SSL. In the first of a two-part series at ASP To...
Click for more...
HTTPS Server Variable
In previous tips, I showed you how you could use the SERVER_PORT variable to determine if the user is viewing your site on a secured port. However, an easier wa...
Click for more...
Improving Output Performance
To increase the performance of your web page output, you can use output buffering. Output buffering stores all of the output while the page is being built. Howe...
Click for more...
Improving Site Performance
There are some simple things you can do to improve your web site’s performance. The actual things you can do are based somewhat on the structure of your site, b...
Click for more...
Include Files Can Have Any File Extension
While Microsoft's documentation indicates that include files should be suffixed with ".inc", this is not required. In fact, if you suffix it with .asp, you can ...
Click for more...
Including Files
If you're duplicating code in your ASP pages, you're doing more work than you have to. A part of the ASP engine is the ability to include files into other files...
Click for more...
Index Server Manager
Trying to figure out how to build a full-text catalog with IIS? The controls aren't in the Internet Service Manager – at least, not all of them are. When you c...
Click for more...
Indexing Robots and Your Site
Most search engines perform "spidering" when they visit your site. They read a page, retrieve all the links from the page, and follow all those links. Eventuall...
Click for more...
Input Boxes for Numbers
A question I received recently asked what sort of form control he should use for accepting numeric data on a form. His confusion was in the fact that the HTML t...
Click for more...
Installing Personal Web Server
A reader alerted me to the fact that Personal Web Server is also available on the Windows 98 CD-ROM. This version includes the ASP engine, Transaction Server, a...
Click for more...
Integration with QuickBooks
A user recently asked me if it was possible to integrate ASP with QuickBooks. The short answer is unfortunately no. QuickBooks uses a proprietary format for sto...
Click for more...
Learning XML
In case you've been living under a rock, you've probably heard about XML and the great potential it has as the next language for the web. If you want to try out...
Click for more...
Limiting Results
A user asked how to limit the results from a database query to say, 100 records. There are a couple of ways to do this. The first is to use the SELECT COUNT fea...
Click for more...
Linking to External Sites
One of the hardest things for web site owners to do is to put up links to other sites. It's not that creating the links is hard; rather, putting up external lin...
Click for more...
Listing 15-01: Typical Data Entry Form
Click for more...
Listing the System DSNs
This article, by Mike Shaffer, provides a free component to obtain a delimited list of System DSNs on a Web server. This component works with both PWS and IIS. ...
Click for more...
Maintaining Login State
In certain applications, it's important to determine whether the user is logged into the application. This is especially important on financial and other sensit...
Click for more...
Maintaining State Between Windows
A number of users have asked how to share information between multiple windows that may have been opened via JScript/Javascript. There are a couple techniques y...
Click for more...
Managing Saved Recordsets
In previous tips, I talked about the ADO Recordset's ability to save to a file and be reloaded from the file into memory. A reader asked how to manage multiple ...
Click for more...
Manually Creating a Recordset, Part 1
In previous tips, I mentioned the fact that ADO Recordsets don't necessarily have to be created directly from database tables. In fact, you can build a recordse...
Click for more...
Manually Creating a Recordset, Part 2
In the last tip, you created a recordset without a live database connection. In this tip, you'll see how to add data to the recordset. Here's the code so far, w...
Click for more...
Manually Creating a Recordset, Part 3
In the past two tips, you've been creating a recordset without the use of a database connection. In this tip, you'll learn what you can do with this recordset o...
Click for more...
Manually Including a File
While server-side include directives can’t be processed dynamically; that is, using ASP variables for filenames, you can perform the same action by opening the ...
Click for more...
Manually Including a File
In previous tips, I've discussed the power of server-side include files and how they can simplify your programming. However, the filenames used in server-side i...
Click for more...
Marking the End of Next Loops
Since VBScript doesn't allow you to add a variable name to the Next statement, your loops can get confusing. However, you can always add a comment to the end of...
Click for more...
Microsoft Access and Web Servers
If you're using Microsoft Access for your web database, remember that the database has to be in a directory that is writeable by the user ID used by the web ser...
Click for more...
Microsoft Data Engine vs. Microsoft Access
While Microsoft Access works reasonably well for small web sites, it just doesn’t have the scalability of SQL Server. However, for most people, SQL Server’s pri...
Click for more...
Microsoft Party Line on VBScript and Jscript
Want to hear about Microsoft's plans for VBScript and JScript? Read this article by...
Click for more...
Modifying a Record's Primary Key
A user asked if it was possible to modify the primary key of a database record. This depends on how the database table was created. If the database table uses a...
Click for more...
Move Methods Not Available
In a recent question, a user asked why, when he created a recordset, that some of the move methods, such as MovePrevious and MoveLast are not available. The rea...
Click for more...
MovePrevious Not Working
A user recently sent me a question about why the MovePrevious method was not working in his recordset. The explanation is that the recordset can't be created as...
Click for more...
MSDE White Paper
In a previous tip, I referenced a white paper that was available on Microsoft's web page that covered the Microsoft Data Engine. That white paper is actually av...
Click for more...
MTS Components Must Be Registered
We’ve had some recent tips about using Microsoft Transaction Server with DLLs created in tools like Visual Basic. One thing to remember is that while you can dr...
Click for more...
Multiple Submit Buttons on a Form
If you have a form with multiple SUBMIT buttons on it, you can determine which button was clicked by looking at the button's value in the Request.Form data coll...
Click for more...
New Cookies Available Immediately
If you're writing a cookie out to a user with the Response.Cookies collection, that cookie is available immediately to your application through the Request.Cook...
Click for more...
New Timer Function
If you’ve ever wanted to time your scripts to make sure they don’t take too long, VBScript 5.0 has a new feature for you: the Timer function. This function retu...
Click for more...
No Control Arrays in VBScript
If you've used Visual Basic, you're probably familiar with control arrays. Control arrays allow you to group all your option buttons, for instance, under a sing...
Click for more...
No Format Function
If you're coming to ASP from VB, you are going to be distressed to find out that there is no Format function. Instead, VBScript supports a series of formatting ...
Click for more...
No Script in Include Directives
Because of the way ASP processes include and other server-side include directives, you can't have any script in your actual directives. The directives are proce...
Click for more...
Offload String Processing
If you're retrieving text from a database, let the database do as much of the text processing and formatting as is possible. The database can do this task much ...
Click for more...
Omit Empty Global.ASA Events
It’s not necessary to always provide a global.asa file and all four event handlers if you’re not using them. If you’re not using any of the Application or Sessi...
Click for more...
Ownership of Code
Here’s a non-technical tip for today. A user asked about ownership of code that he wrote for a client. The basic answer is: it depends what you negotiated. Typi...
Click for more...
Page Size Issues
When we were all learning how to make good web sites, one of the rules of thumb was that a page should be less than 30kb, which translates to approximately 15 s...
Click for more...
Paging Through a Database Recordset
The ADO Recordset has an extra feature that makes it very easy to create paged output. Let's say that you have 1000 records in the resulting recordset and you w...
Click for more...
Paging Through Large Recordsets
One of ADO’s nicer features is its ability to work with large recordsets on a page-by-page basis. This means that if you have a recordset of 1000 records and on...
Click for more...
Passing Objects to COM Components from VBScript
Using COM components; that is, ActiveX DLLs created in a language like Visual Basic, can really speed up processing on your ASP application. If you ever need to...
Click for more...
Passing Variables Between Pages
A user asked how to pass a “variable” between pages without using the Session object. Without using the Session or Application object, there is currently (IIS 4...
Click for more...
Passing Variables to and from ActiveX Controls
A reader asked about a problem he was having in passing values to and from an ActiveX control from VBScript. He had created a method on the control that has one...
Click for more...
Performance Improvements in IIS 5.0
Here's some information provided by Alan Silver about the greatly improved performance in IIS 5.0:
Microsoft did some tests on ASPs vs COM DLLs in IIS5 an...
Click for more...
Permanent vs. Temporary Cookies
If you're using cookies in your application, you may be using temporary and permanent cookies. Temporary cookies are cookies that are created without an expirat...
Click for more...
Permission Denied for E-Mail
A previous tip suggested that if you were unable to send e-mail from your web page, it might be that your web user ID didn't have permission for the e-mail obje...
Click for more...
Personal Web Server Workshop
If you've had problems running Personal Web Server on Windows 98, you might be interested in a free workshop at this web site:
Click for more...
Preventing a Page from Caching
In a previous tip, you learned about the Expires property of the Response object and how it can be used to “expire” your page. This would, in theory, prevent a ...
Click for more...
Printing Values without the Response.Write Statement
If you are embedding HTML in your ASP page, you can print variables and expressions without having to use the Response.Write statement. Here's an example:
Click for more...
Problems with Access Databases
Here's a quick tip if you're using an Access (or other file-based database) database with Active Server Pages. You have to make sure that the directory in which...
Click for more...
Protecting Yourself from Scripting Attacks
In this article at ASP Today, James Brannan wrote an article about how to prevent cross-site scripting attacks on your site. Here's the URL:
Click for more...
Ready or Not, Here Comes XML
Not sure how your ASP application fits in with XML? Here’s an article in Windows NT magazine that explains how the two technologies fit together:
Click for more...
Rebooting the Web Server
If you're doing much development using server-side components, you'll have found that once the DLL has been used by IIS, you have to reboot the web services in ...
Click for more...
RecordCount = -1
A user asked me recently why he was getting RecordCount values equal to -1. The reason is that he had created a ForwardOnly recordset. ForwardOnly recordsets do...
Click for more...
Redirecting the Browser
Need to move to another page? Make sure you use the Response.Redirect method before you generate any output. This is because the redirect request goes into part...
Click for more...
Referencing the ADO Library
Eric Vegter recently reminded me of a tip I published a while ago regarding the ADOVBS.INC file, which contains all the constants used with ADO. Instead of incl...
Click for more...
Register Your DLLs
If you're building applications that use either custom-built or third-party DLLs, remember that you have to register them on the web server in order to use them...
Click for more...
Registering a Domain
Contrary to what Network Solutions wants you to think, they aren't the only game in town for registering your domain. If you're building a site (ASP enabled or ...
Click for more...
Releasing Objects
When you're done using an object, it's good to set it to Nothing to indicate to the system that you're no longer using it. While you can do this in ASP, be awar...
Click for more...
Remember to Set CommandType
A problem I ran into recently involved an ADO Command object. I was trying to use a stored procedure with SQL Server. After setting everything, including the pa...
Click for more...
Remembering a User's Input
In many large forms, there are many possibilities for errors on the user's part. One thing that absolutely drives me nuts is to have filled out a huge form, rec...
Click for more...
Remembering a User's Input
Note: this tip was posted last month, but the "method=post" was left out of the FORM tag. The code below takes care of the problem. Also, make sure that there i...
Click for more...
Remote Administration
One of the overlooked features of Internet Information Server 4.0 is its ability to be administered remotely via the web. Depending on the installation options ...
Click for more...
Remote Server-Side Includes
I've published several tips on server-side includes. A question that came up recently was whether you could include a file from another server. Unfortunately, t...
Click for more...
Removing DLLs from Memory
When testing your COM components with your ASP application, it can be frustrating when you have used the DLL and can't recompile it because the file is in use. ...
Click for more...
Request Object Collections are Optional
When you're retrieving information from the Request collection, you probably do it like this:
strTemp = Request.Form("txtName")
However, you...
Click for more...
Restarting the Server Remotely
Steve Neel sent in a tip on how to create a script to start and stop your web server without having to be on the console. The script will prompt for the server ...
Click for more...
Retrieving Recordsets
If you need a read-only copy of data from a database to populate some sort of list or table, the best type of recordset to use is a forward-only, read-only reco...
Click for more...
Retrieving XML Data into ASP
In this article at ASPToday.com, James Stansfield shows you how to retrieve XML-formatted data into your ASP pages. The article shows how to read an XML file of...
Click for more...
Review of Macromedia UltraDev
Macromedia has a new tool out called UltraDev that is able to edit ASP code. This tool is a replacement for the older Drumbeat product that has since been disco...
Click for more...
Run ASP on Windows 95 and 98
If you don't have an NT Server to run Internet Information Server on, you can still use Active Server Pages. The core functionality of IIS is available for Wind...
Click for more...
Saving a Recordset
One of the features of the ADO Recordset in ADO 2.5 is the ability to save the recordset to a disk file. There are currently two file formats that you can use. ...
Click for more...
Scheduling a Page to Run
A user asked if there was a way to schedule an ASP page to run every month at a specific time. Not knowing what the purpose of this is, there are a couple of wa...
Click for more...
Scriptless ASP Files
In IIS 4.0, it is more efficient to name all static content files (with no ASP code in them) using a .HTM or .HTML extension. The server doesn’t have to process...
Click for more...
Searching Long Text Fields in SQL Server
One thing I currently do on the ASP Techniques (asptechniques.com) web site is store all the content in a SQL Server database. Because I have some long text art...
Click for more...
Searching Text Files
4GuysFromRolla.com has published "Searching Through the Text of Each File on a WebSite," an article that demonstrates how to build a paged search engine that wi...
Click for more...
Sending E-Mail from ASP
Several previous tips covered how to send e-mail from an Active Server document. One reader wrote back saying that he was getting a permission denied error when...
Click for more...
Sending Non-HTML Content
In some applications, such as an ad management system, you need to be able to send other types of content from your ASP pages other than HTML. This is easy to d...
Click for more...
Sending Plain Text
If you ever have data that you need to send via plain text, you can do it using the Response.ContentType property. By setting this value to "text/plain", your b...
Click for more...
Sending SMTP Mail from ASP
Several previous tips have referred to sending SMTP mail using the CDONTS.NewMail object. In order to use this object, you have to install the SMTP server when ...
Click for more...
Server.Execute Works Locally
Similar to the server-side include directives you can use, the Server.Execute routine can only execute ASP files located on the current web server. It is not al...
Click for more...
Session Variables and Load Balancing
A number of readers have written to me about the positives and negatives of using Session variables. In this article by Bart Gerardi, the implications of Sessio...
Click for more...
Setting Objects to Nothing
In ASP, it is no longer necessary to set your objects to Nothing before ending the page. In previous versions, garbage collection was very poor and if objects w...
Click for more...
Showing Graphs and Charts on a Web Page
A user asked about the best way to show a graph or chart on a web page. For this, you basically have three options. First, if the chart isn't really complica...
Click for more...
Showing HTML Efficiently
In a previous tip, I showed that you can "dump" HTML to the user by simply adding it outside of the ASP delimiter tags. As several users have reminded me, ASP t...
Click for more...
Showing Values in Form Fields
Remember to surround your form field VALUE parameters with double quotes when you are showing a value, as shown here:
<input type=text name=txtInput ...
Click for more...
Simple E-Mail Validation
A common question when accepting input data is how to validate an e-mail address. There are a couple of steps in the validation. First of all, you have to check...
Click for more...
Site Server's DirectMail Functionality
In this article at ASP Today, learn how to use the DirectMail feature of Site Server 3.0 to keep your customers and visitors updated on what your site does. Her...
Click for more...
SiteExperts.com
A site I recently learned about, SiteExperts.com, has lots of resources for all types of web development, including ASP, CSS, JavaScript, and more. Here's the U...
Click for more...
Specifying Network Library for SQL Server
The typical connection string I use for SQL Server looks something like this:
cnDB.Open "Provider=SQLOLEDB;" _
& "Data Source=(local);" _
...
Click for more...
State Preservation and the Session Object
A reader wrote asking what the purpose of the Session object is in preserving state. He also wondered how the server determines what data goes with each user if...
Click for more...
StaticObjects Collection
If you're defining objects in the global.asa file using the OBJECT tag, you can access those objects in your code through the StaticObjects collection of the Se...
Click for more...
Storing Pictures in a Database
While some databases support it and others are even designed for it, I would strongly avoid storing pictures in databases. Your databases will bloat and require...
Click for more...
Testing ASP Applications
One of the problems with testing ASP applications is that you have to replicate the server directory structure to perform valid tests. However, if you are worki...
Click for more...
Timer Function Fixes
In a previous tip, I showed you how to time the execution of a function within ASP. However, that code didn't take into account the fact that a script might exe...
Click for more...
Timing the Execution of Scripts
In this article at the 4GuysFromRolla.com site, there is an article covering how to time the execution of your ASP script code. View the article by clicking her...
Click for more...
Tip Archive Available
If you’ve missed some tips in the past or have gotten so many you can’t keep track of them, have no fear. The ASP Techniques web site (asptechniques.com) has an...
Click for more...
Tracking Clickthroughs to an External Site
Here's an article at the Developers' Domain site about tracking clickthroughs to a site.
Click for more...
Tracking IP Addresses
One of the server variables that you have available to you through the Request object is the IP address, stored in the REMOTE_ADDR variable. However, this won't...
Click for more...
Unloading DLLs for a Web Site
There have been several previous tips about how Internet Information Server “holds onto” DLLs that you use in your ASP pages. It turns out there is a much easie...
Click for more...
Updating an Access Database
A user asked me why, when he attempted to upload an Access database in place of another one, he got errors indicating that the file is in use by another process...
Click for more...
Updating Components and Microsoft Transaction Server
One of the nice benefits of Microsoft Transaction Server, Cris Brady reminded me, is that you can remove and add components to MTS packages without any rebootin...
Click for more...
Updating Databases
If you're writing applications to update your database with either new or modified records, you've got several options with ADO. You can create a dynamic record...
Click for more...
Use ASP Pages Sparingly
Even if you're running an ASP-enabled server, you should also use files with HTML extensions. ASP files take longer to process than HTML pages, so you only want...
Click for more...
Use Server.Transfer instead of Response.Redirect
I do a lot of redirection in my web applications. A user logs into a page and an ASP file processes the input. When the user login is validated, the Response.Re...
Click for more...
Using Access Databases with ASP
A few questions about Access databases have come up in regards to ASP. One of the first things you have to do is to make sure your database is in a directory th...
Click for more...
Using API Calls in ASP
A question that has been sent to me a few times is whether or not you can use API calls from within an ASP page. The answer is yes, but with a few caveats. The ...
Click for more...
Using ASP with ODBC Databases
In many tips, we've been referring to finding your OLE DB provider. Unfortunately, many databases do not yet have OLE DB providers. If this is the case with you...
Click for more...
Using Assignment Statements
In ASP, you can cause a variable or expression to be printed using the
Click for more...
Using Classes in VBScript 5.0
One of VBScript’s newest features is the ability to use classes, just like in VB or VC++. Here’s an article at ASP Today about this new feature, currently avail...
Click for more...
Using Control-Naming Prefixes
To make it easier to determine the type of control you're looking at when viewing the Response object, name your HTML controls with easy-to-remember prefixes. F...
Click for more...
Using Disconnected Recordsets
If you're using COM or DCOM components in your ASP application, you often need to return a large amount of data. The alternatives for doing this include creatin...
Click for more...
Using Include Files
This tip was included a few weeks ago, but there was some confusion about how to use it. Include files allow you to share code between files without having to d...
Click for more...
Using Links with Images
If you've written much HTML, you know how long your lines get when you are wrapping a URL around an image. If you break the line into multiple lines, you get od...
Click for more...
Using Move Methods with Recordsets
Some readers have had various problems using the Move methods with their Recordset objects. The basic rule is that the recordset must support bookmarks or backw...
Click for more...
Using MTS Components with ASP
In a previous tip, I mentioned that components you use with Microsoft Transaction Server (MTS) have to first be registered on the server before you can add them...
Click for more...
Using n-Tier Techniques with ASP
Just like a VB application, an ASP application can make use of business objects that have been compiled into ActiveX DLLs. In fact, by putting your business log...
Click for more...
Using Option Explicit
If you don't regularly declare your variables, you can run into problems with typos in variable names. VBScript automatically creates variables as it sees the n...
Click for more...
Using Parameterized Stored Procedures
If you're calling a stored procedure (or query for the Access folks), you don't always have to create a Command object to do it. Instead, you can pass your para...
Click for more...
Using PerlScript with ASP
A reader asked why I hadn’t mentioned PerlScript as a language to use with ASP. Any supported scripting language on NT can be used to write ASP code, which incl...
Click for more...
Using Request.ServerVariables is Expensive
The ServerVariables collection of the Request object can provide some useful information; however, getting to that information is somewhat expensive in time. Fo...
Click for more...
Using Session Cookies
If you've got a simple web site and aren't using any Session variables, you can disable them using a simple directive at the top of the page:
<%@ ENA...
Click for more...
Using Session Variables
One of the features provided by ASP that I almost never use is the Session object. While it looks like it will solve all your problems in sharing data between p...
Click for more...
Using Session Variables for Security
While using Session variables for everything is not a good idea, you can use them sparingly for instances such as login security. A basic security scheme you ca...
Click for more...
Using Session Variables to Maintain Security
Depending on the application you have, you may need to enforce security on pages. However, you can't just check the person's login on one page and send them on ...
Click for more...
Using Spaces Instead of Tabs
Regardless of the text editor you're using to develop ASP code, remember that tab characters and spaces are not the same animal. Most tools, such as HomeSite an...
Click for more...
Using SQL Server for Date Processing
As you learned in an earlier tip, ASP is slow when it comes to formatting text. In addition, it has few functions for manipulating dates. For this reason, I dec...
Click for more...
Using SQL Server for String Processing
If you’re not aware, VBScript in ASP is relatively slow when it comes to string manipulation. If you’re doing a lot of string “stitching” using data from a data...
Click for more...
Using SSL With Include Files
If you're using SSL on your web server, be sure that all files involved with the pages being sent via SSL are in protected directories. For instance, if you're ...
Click for more...
Using Style Sheets and SQL for Output
As some of the earlier tips have said, it's much quicker to manipulate strings within either SQL Server or compiled components. However, if you are generating H...
Click for more...
Using the ADO Field Attributes Property
Every time you create a recordset, ADO is sending you back lots of information about the data you selected. The complete list of attributes is available in your...
Click for more...
Using the ADO Filter Function
A reader recently wrote in complaining about the lack of speed of the ADO Filter function. He was filtering records in a 720 Mb Access database and was trying t...
Click for more...
Using the Bill of Materials Structure
One of the most useful things about relational databases is the ability to create parent-child relationships in a single table. An example of this is on the ASP...
Click for more...
Using the Eval Function
A new function in ASP 3.0 and VBScript 5.0, the Eval function will evaluate a function stored in a string variable and return the value. The simple version work...
Click for more...
Using the LIKE Keyword
If you've ever done a search page, you've probably used the LIKE keyword in your SQL statement. This keyword allows you to match values based on a partial keywo...
Click for more...
Using the METADATA Tag
In a previous tip, you learned how to reference the ADO library in your ASP file. This lets you use the constants that are documented along with the ADO library...
Click for more...
Using Type Libraries
Ever get tired of not having all the built-in constants available to you in ASP? You can use a type library in your ASP pages, just as you might do in a tool li...
Click for more...
Validating Data
Here's a tip sent in by Steve Sprague about data validation in ASP applications:
I've used a combination of two different validation methods in the past to s...
Click for more...
Validating E-Mail Addresses, revisited
In a previous tip, I told you that an easy way to validate e-mail addresses is to make sure that at least one period and an at symbol (@) exist in the e-mail ad...
Click for more...
VBSCRIPT in MsgBox Title
A user was mentioning that when he created a MsgBox in client-side VBScript, the title of the message box was VBSCRIPT. You can change this by adding a third ar...
Click for more...
Viewing a List Box's Data
If you have a SELECT list on your ASP page that allows multiple selections (using the MULTIPLE keyword in the SELECT tag), those selections will come into the A...
Click for more...
Viewing ASP Pages in Internet Explorer
A reader recently asked me why, after he created an ASP page on his local computer, it wouldn't work when he loaded it into Internet Explorer. He's got two of t...
Click for more...
Viewing ASP Pages in Internet Explorer
A reader recently asked me why, after he created an ASP page on his local computer, it wouldn't work when he loaded it into Internet Explorer. He's got two of t...
Click for more...
Visual Basic Directory at About.com
One of the better sites for content these days is About.com, and no, this isn't an ad. Every topic within About.com has a live person picking content to show, w...
Click for more...
Visual SourceSafe and ASP
Contrary to popular belief, ASP files are real code and need to be treated as you would any other code file. This means that when you are completed with a build...
Click for more...
Visual Studio Service Pack 4 Available
If you're using any part of Visual Studio, be aware that service pack 4 is now available. A list of fixes and features is at Microsoft's web site:
Click for more...
Web Server Directory Security
With all of the bored hackers out there, you should be sure that your web site has some basic security features set. The first place to start is on the director...
Click for more...
What is ASP Error 0115?
Ever been developing an ASP page and get a ASP Error 0115? After you get it, no matter what you do, you keep getting the error. The reason is that 0115 means t...
Click for more...
What is the File Access Component?
A number of readers have asked me recently about the “File Access Component” of ASP. This is a bit of a misnomer and is not a new component of any sort. The Fil...
Click for more...
When Does a Session Expire?
A user asked me to clarify when a session actually expires. According to Microsoft's documentation, a session will expire after a certain amount of inactiv...
Click for more...
Where to Validate Data
A number of readers have written in describing how they do data validation in their ASP applications. Some use completely server-side validation, some use a mix...
Click for more...
Which Language to Use?
This question keeps coming up, so I thought I should answer it again. Several users have asked whether they can use Javascript with ASP. Here’s the answer: yes....
Click for more...
Working with Multiple Checkboxes
In an application I'm writing, I have a form that shows a large number of checkboxes to the user. These checkboxes each become a record in a database table rela...
Click for more...
Working with Multiple Checkboxes, Revisited
This tip was sent out with a slight error. The fourth line previously checked Request(item.Name) instead of Request(item.Value) as it should have. Thanks to Jay...
Click for more...
Working with Multiple Forms
A reader asked how he can capture the data from two different forms on the same ASP page at the same time. Because of the way form data is submitted, you can on...
Click for more...
Working with SQL Server Currency Fields
A user asked why, when retrieving a database field that is of type Currency, that no currency symbols are displayed. This is because the Currency data type in t...
Click for more...
Working with the Back Button
A reader recently asked me how to pass all the user's data when the user presses the back button. Unfortunately, the back button is simply using the browser's c...
Click for more...
WriteComment Function
In a previous tip, I talked about how you can make debugging easier by generating HTML comments into the output your ASP files generate. Here's the function tha...
Click for more...
Writing a Webpage Counter
Here's an article at askASP.com about writing a web page counter using ASP:
http://www.askasp.com/art...
Click for more...