?
Solved

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

Posted on 2003-03-03
4
Medium Priority
?
259 Views
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)?
0
Comment
Question by:chrismcleod
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

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

'user defined message

else

'normal coding

end if

%>
0
 
LVL 15

Expert Comment

by:gladxml
ID: 8056598
chrismcleod,

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

http://www.4guysfromrolla.com/webtech/070799-1.shtml
0
 

Author Comment

by:chrismcleod
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.
0
 
LVL 3

Accepted Solution

by:
bjrcreations earned 200 total points
ID: 8060023
chrismcleod,

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

762 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