1

I have a RouteMap containing:

routes.MapRoute(
   name: "StaticContent",
   url: "{action}/{controller}/{type}/{content}",
   defaults: new { controller = "Admin", type="img", content="logo.png", action = "Content" }
);

and the handler:

public void Content()
{
   Response.Redirect("/Signin");
}

However, when I access this URL:

http://localhost:55306/Content/Admin/img/logo.png

I can still view the image.

I expect I will be redirected to the Signin page every time I access the URL above.

Any thoughts?

Joseph D.
  • 11,804
  • 3
  • 34
  • 67

1 Answers1

2

By default route handler looks for the static asset your file is there that is why it returns the content. Please follow the following link prevent access to static content of asp.net - mvc app this will give you some idea.