Independent aspx file - conflict with Orchard?

Topics: Customizing Orchard
Mar 8, 2012 at 7:06 PM

This has probably been asked before, but I was curious if a simple aspx file can be dumped into Orchard without mucking up the whole system.

You see, I am looking to make a server-side image rotater, which would scan the directory it is in for files with a specific extension (JPEG, etc.) and then choose one at random before passing that image’s data stream (mime-type and everything) off as itself to the requesting client.

I have done this many times before with images stored in a database, but not within a CMS like Orchard. I have always built my own site from the ground up, and Orchard is the first MVC ASP.NET framework I have dealt with.

So, should I expect this to work, so long as the ASPX file is the only non-image file in the directory and it doesn’t do anything except work with the images?

Mar 8, 2012 at 8:27 PM

You'll need to modify web.config to explicitly allow it: Orchard locks down the config by default.

Mar 8, 2012 at 10:28 PM

The web.config at the root, or the web.config in the directory in question, where both the images and the aspx file will sit?

And would you know how it is locked down? I’m not sure what to look for, as I’ve never been in a position where I wanted scripts to not work and so therefore would have never needed to do this (or reverse it).

Mar 8, 2012 at 10:35 PM

You should be able to add a web.config in the folder from where you want to serve the .aspx file, just like the Media folder is "unlocked" in order to bae able to serve static files using the StaticFileHandler. In the same way, I think you can reastblish the link between the .aspx extension and the handler that should be used to execute .aspx requests.