?
Solved

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

Posted on 2012-09-21
1
Medium Priority
?
383 Views
Last Modified: 2013-06-25
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??
0
Comment
Question by:srepolavarapu
1 Comment
 
LVL 19

Accepted Solution

by:
mrwad99 earned 1500 total points
ID: 38426814
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

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question