468,457 Members | 1,601 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

how can you catch the Server.MapPath error?

i get the common error message when using the Server.MapPath() error. which is

Server.MapPath() error 'ASP 0173 : 80004005'
Invalid Path Character
An invalid character was specified in the Path parameter .....

My question is, how can i handle this error message.
in other words, i would like the server in this case to display a custom message that i will make

thank you
Apr 14 '11 #1
1 2890
200 Expert 100+

"On Error Resume Next" and "Err.Number" are your friends here:

Expand|Select|Wrap|Line Numbers
  1. <% On Error Resume Next
  2. Dim Foo
  3. Foo = Server.MapPath("Bad,Path")
  4. If Err.Number <> 0 Then
  5.         Err.Clear 'So we can trap other errors later.
  6.     'Show your error message
  8. Else
  9.     'Do stuff.
  10. End If %>
Apr 17 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by tshad | last post: by
2 posts views Thread by Scott | last post: by
7 posts views Thread by benoit | last post: by
14 posts views Thread by Lorenzo | last post: by
5 posts views Thread by MichiMichi | last post: by
4 posts views Thread by vunet.us | last post: by
3 posts views Thread by =?Utf-8?B?YzY3NjIyOA==?= | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.