By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,855 Members | 1,970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,855 IT Pros & Developers. It's quick & easy.

how can you catch the Server.MapPath error?

P: 3
hello,
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
Share this Question
Share on Google+
1 Reply


GazMathias
Expert 100+
P: 189
Hi,

"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
  7.  
  8. Else
  9.     'Do stuff.
  10. End If %>
  11.  
Gaz
Apr 17 '11 #2

Post your reply

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