3

I have a route that basically looks like this:

Foo/{id}/Files/{*path}

I want it to match a URL such as:

http://mysite/Foo/Bar/Files/Baz.cs

However, I get an HTTP 404.7 error that says "The request filtering module is configured to deny the file extension." I can remove the file extension from request filtering by modifying web.config, but I don't want my source code to be viewable. How should I set this up?

Daniel Plaisted
  • 16,674
  • 4
  • 44
  • 56
  • 1
    i think you should add it to ignore list look here http://stackoverflow.com/questions/6186008/asp-net-mvc-ignoreroute-method-doesnt-work-correctly-when-url-starts-with-vie – hackp0int Jan 12 '12 at 07:42

2 Answers2

1

The only way you might have possibility to get it working is through relaxedUrlToFileSystemMapping setting in ASP.NET 4.0. You can read more here:

tpeczek
  • 23,867
  • 3
  • 74
  • 77
0

If the paths to the files don't match with the urls you want to have than you can do the following:

  1. mark the folder where you keep your source files as denied for everyone in the web.config (example for the /SourceCode dir)

  2. allow the .cs extension in the request filtering module

linkerro
  • 5,318
  • 3
  • 25
  • 29