Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Detecting 401 Errors with script (classic ASP), So as to Display Custom Error

Posted on 2003-03-03
Medium Priority
Last Modified: 2008-03-17
I'm building a clients area on our website, and am trying to have a page that displays any relevant login errors that occur, of which there are 3 different script-generated errors: username/password combination not found, e-mail address not validated yet, or account not activated by admin yet. Any of these errors occuring, sends the user to the error page and an appropriate message is displayed.

The site uses basic authentication/file permissions as the login method. Obviously, if the permissions on the file do not match the supplied credentials, then the user gets a 401 error, and the script doesn't run, no scripted error messaged are generated, and the user is sat there wondering what to do.

What I want to do, is detect any 401 errors (not authorised due to wrong file/folder permissions) and send them to the same error page as my other login errors, with the error detected and a suitable message shown.

Anyone know of a way of doing this? I know part of the solution is configuring ISS to go to the error file on a 401, but how can I get the script on the error page to realise it's a 401 and display the appropriate error? Or will I have to have multiple error pages (what I'm trying to avoid, for easy maintenance)?
Question by:chrismcleod

Expert Comment

by:Sashi Rachabattula
ID: 8056291
try this
if err.number=404 then

'user defined message


'normal coding

end if

LVL 15

Expert Comment

ID: 8056598

You can try to look at this article might help...


Author Comment

ID: 8057053
gladxml - that article doesn't help me in the slightest, I'm afraid. It's about creating a drill-down application, nothing to do with what I'm needing... sorry.

Accepted Solution

bjrcreations earned 200 total points
ID: 8060023

If you have access to IIS then you can customize your 401 error page to do just about anything you want.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Screencast - Getting to Know the Pipeline
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question