Hints & Tips when working with ASP
Turn off "Show Friendly HTTP error messages"
If you are getting errors with your ASP application go to Internet Explorer
and make sure this setting is unchecked.
Having this checked can cause a generic error to be displayed in you web
browser when ASP code encounters an error. This generic error message
doesn't really help you fix the problem. Having this setting unchecked will
usually result in a more detailed error message and the line number the error
is occurring at, thus giving you a good clue as to where the problem is
within the ASP code. If detailed ASP error messages have been disabled at
the server level this setting will make no difference.
Editing ASP code with various editors.
Besides simple text editors most editors create and manage ASP code
differently. Usually code written with one editor may not be friendly
in another. For example sometimes editors like Ultradev, FrontPage, Dreamweaver, etc mess up
existing code or display errors when there are really no
errors. They just don't understand the code and think it is bad. You need to understand this and if you are editing code that was not
created with your editor of choice you should always back up the code before
making changes. Then if you break the ASP when you save it with your editor
you can revert back to a working copy. This sounds like common sense, but
trust me some people just don't use their head. Additionally some editors allow you to
edit code in text mode as well as a WYSWYG Interface and sometimes you may
have to edit some code in text mode or with a colored coded text editor. A
good example of this is if you buy a pre-built ASP application. There is no
guarantee it will be friendly to your editor as the creator of this code
may have used a different editor to create the application or even hand
coded it. For the most part it will always be safe to open and save ASP code
with a text editor. I recommend that whatever editor you use that you also
have a good colored coded text editor as well. I also recommend when using Microsoft
FrontPage that you enable the "Show All" button. It looks like a PIE symbol
and will make all line breaks visible and also show areas of ASP code as
little yellow icons. This way you don't delete areas of code you can't see.
Be aware unless carefully designed to be FrontPage compatible FrontPage will
usually mess up ASP code not written in FrontPage.
Knowing what pages to edit.
Ok .. this one really gets me. Here is an example. People will say I want to
edit your ASPProtect
application so that some form fields don't show on the registration screen.
Then they ask what page do I edit. Well again, simply use common sense.
Browse until you get to the page you want to change in your web browser.
When you get to that page simply look at the URL address window in the
browser. If it says something like "http://www.mysite.com/aspprotect/users/register.asp"
then the page you want to edit is most likely "register.asp" in the "aspprotect/users"
folder. Also because we are dealing with a form it may post to another page.
To see what page it posts to simple look at the action of the form as you
may have to edit that page as well. A page may also have a server side
include to another page where code may need to be edited as well. When you edit something
it up before you start. This way if you mess it up you can revert back to
the original code. BTW.. holding your mouse over a button or hyperlink and
looking in the bottom left corner of your browser in the Status Bar is also
a good way to tell what pages are doing what.
Server Database Permissions
Your ASP/Database code isn't going to run if everything isn't
I have already written an article on this and I suggest you read it if you
have problems with setting up data connections.
Click here for that article.
Netscape and ASP Browsing Problems
This is not related to common sense
but it is a helpful thing to be aware of.
I am not sure why though it may have to do with buffering and Netscape's
rather slow rendering engine when it comes to complex tables and CSS, but
sometimes when using Netscape to browse ASP code from the same computer that
is serving the ASP pages it runs extremely slow. It sometimes even acts like
it is going to time out. Once the code is browsed by Netscape from a remote
computer it runs fine. This doesn't happen all the time but it has been
known to happen so be aware of it.
Move along one step at a time.
So many people when coding ASP just don't understand this very simple
concept. When building an ASP application add bits of code and test them
before adding more code. It makes no sense to throw a ton of code functions
into a page and then later on try to troubleshoot why it doesn't run. If you
test each part as you go you will be a lot better off in the long run.
ASP Applications just stop working.
Well, if your ASP Application was working and suddenly stopped working then
most likely something on the web server changed. Sometimes especially on
hosted servers permissions on directories change and need to be set again.
Sometimes they move your site to a new directory or server and things
change. Sometimes components need to be re-installed. Sometimes the server
needs some tender love & care and sometimes even a simple reboot can cure
your problems. There are a lot of reasons things could stop working and it
usually not the code unless some files have become corrupted.
For the most part do not design new code on a live server.
Unless you have no choice or you are very experienced you really shouldn't
design new asp code on a live server. Invalid SQL statements and bad data loops can
cause major strain on the web server and even cause memory leaks or make the
server crash. You should
always run and install ASP code locally on a development server and then
upload it to the live server when it seems to be running correctly. Be aware
some settings may be different on the local server and the live server so
you may have to change some things when uploading to the live server.
Personal Web Server is a good ASP testing environment and runs on
Win95/98. If running windows NT or 2000 you can install IIS and run ASP
The web is one of your best sources when it comes
to learning classic ASP.
This is my last tip and probably the most important. Unlike when I started
using ASP many years ago the web is now full of great articles and examples.
Though there are some good books available now just
about anything you need to know is available on the web and is free.
Downloading free applications is also a great way to learn how things work.
See our links page for some of the best places to look.