4

I want to be able to have a folder which allows regular access like the \content folder except that it holds a ClickOnce application. I can't seem to be able to achieve this using Mvc, but I'd like to have this folder accessible without Mvc seeing it as a controller action.

I tried using routes.Ignore(theUrl), but this seemed to have no effect.

Leniency
  • 4,984
  • 28
  • 36
jaffa
  • 26,770
  • 50
  • 178
  • 289

2 Answers2

2

There are two ways you can do this. The first is where you are currently going, which is to satisfy it with routing. You should be able to use the following to ignore the intended route:

routes.IgnoreRoute("...")

However, this might not be the right approach from a security stand point. I would recommend you define an explicit action to download your click-once exe. Have a look at this q/a as an example of using the FileContentResult class.

The reason for this is that you can control security for that file without having to open up access levels to other directories.

Edit: If this is for an entire directory, you can still follow this same approach.

Community
  • 1
  • 1
David Savage
  • 760
  • 5
  • 15
  • Hi, the problem with this is that I'm not sure if ClickOnce needs more than just access to a file. Theres a sub-folder with a load of assemblies underneath it. Not sure I want to go this route... – jaffa Jan 24 '12 at 15:33
1

Set up the folder as a virtual folder in the website on IIS. then you can set the url in the code to point to the machine serving the request and to the virtual folder on the web server.

Brian
  • 2,229
  • 17
  • 24
  • Not sure I understand, the folder is in a sub-folder off the Mvc application. Why would another machine serving the request come into this? – jaffa Jan 24 '12 at 15:18
  • if you have load balanced web servers or you move the site to a new web server. Always a good practice to not have things hardcoded. Also makes it a little easier when doing things from a virtual folder. – Brian Jan 24 '12 at 16:30