Click to See Complete Forum and Search --> : preventing from errors to be seen on screen


pelegk1
11-17-2003, 04:03 PM
is there a way to catch an erorr so it wont be show on the user screen?
for example if there is a problem with the sql
the error wont be show on screen
i know that in php u put @ before the command and it prevents it from being show on screen
is there something like that in asp?

PeOfEo
11-17-2003, 04:05 PM
use the custom error controls to make it redirect to an error page (similar to a 404 page) or write a try catch statement to catch errors.

pelegk1
11-17-2003, 04:17 PM
is there a try catch in asp?how?

PeOfEo
11-17-2003, 09:07 PM
ugh, I do not know the exact syntax in asp classic so let me do a search... ok I looked around and I do not even believe there is one in asp, but there is in asp.net. Here is what you can do in asp.

If Err.Number <> 0 Then
Response.Write "Number : " & Err.Number & "<br>"
Response.Write "Source : " & Err.Source & "<br>"
Response.Write "Description : " & Err.Description& "<br>"
Response.End
End If

Ill put the asp.net code up for the heck of it

Try
some block of code
Catch Ex As Exception
some exception
End Try

as you can see asp.net uses straight up vb not vbscript. Hope that if statement for asp does the trick though.