tags:

views:

66

answers:

1

I have a MVC controller called Downloads. http://mysite/Downloads

I also want to put a physical file in a physical folder called http://mysite/Downloads/MyFile.zip.

If I simply create a folder, I get a 403 when browsing to http://mysite/Downloads. (Most likely because of directory browsing is disabled) But I want the MVC controller to kick in instead.

How do I do that?

+1  A: 

If you browse to http://mysite/Downloads/{ACTION} it will fire your controllers action.

The only thing that won't work in your example is the /Downloads with no action. You could re-write this URL to redirect you to your default action.

In addition, you will need to have the routehandler ignore your download files. Add a line in your global.asax file to ignore all zip files? Or some other ignore pattern that suits.

routes.Ignore("{resource}.zip");

Kindness,

Dan

Daniel Elliott