How to override response "403-Forbidden" with "404-File not found" using ProcessRequest

Working on one of the asp.net application. Whenever the user type any folder name like "css" or "scripts" it should throwing a "403-Forbidden" error which means there is a possibility for security vulnerabilities. Instead the response should throw an "404-File not found".

Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest

        Dim url As String = context.Request.Url.ToString
        If (url.ToLower().Contains("css")) Then
            context.Response.Status = "404 File Not Found"
            context.Response.AddHeader("Location", url)
        End If
    End Sub

<add verb="*" path="??????" type="MyHttpHandler.MyHttpHandler"></add>

Please suggest me. What i need to specify in the path??
srepolavarapuAsked:
Who is Participating?
 
mrwad99Commented:
You can do this by modifying your web.config code.  To save my fingers,

http://forums.asp.net/post/4152906.aspx

gives a complete run down of how to do this:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.