how can you catch the Server.MapPath error?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kyrillos
    New Member
    • Mar 2008
    • 3

    how can you catch the Server.MapPath error?

    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
  • GazMathias
    Recognized Expert New Member
    • Oct 2008
    • 228

    #2
    Hi,

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

    Code:
    <% On Error Resume Next
    Dim Foo
    Foo = Server.MapPath("Bad,Path")
    If Err.Number <> 0 Then
            Err.Clear 'So we can trap other errors later.
    	'Show your error message
    	
    Else
    	'Do stuff.
    End If %>
    Gaz

    Comment

    Working...