I'd make a separate folder (like "DynamicContent" or something) to keep those dynamic pages in and add corresponding IgnoreRoute call to RegisterRoutes method in Global.asax.cs, like this:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("DynamicContent/{*pathInfo}");
...
}
After that users will be able to access those pages using URLs like
http://%your_site%/DynamicContent/%path_to_specific_file%
UPDATE
If you don't want to lay files on server HDD then you may really create a special controller for those files. Route for this should look this:
public static void RegisterRoutes(RouteCollection routes)
{
...
routes.MapRoute(
"DynamicRoute", // Route name
"Dynamic/{*pathInfo}", // URL with parameters
new { controller = "Dynamic", action = "Index"} // Parameter defaults
);
}
Your DynamicController.cs should look like this:
public class DynamicController : Controller
{
public ActionResult Index(string pathInfo)
{
// use pathInfo value to get content from DB
...
// then
return new ContentResult { Content = "%HTML/JS/Anything content from database as string here%", ContentType = "%Content type either from database or inferred from file extension%"}
// or (for images, document files etc.)
return new FileContentResult(%file content from DB as byte[]%, "%filename to show to client user%");
}
}
Note that asterisk (*) before pathInfo will make this route grab entire URL part after Dynamic - so if you have entered http://%your_site%/Dynamic/path/to/file/something.html then an entire string path/to/file/something.html will be passed in parameter pathInfo to DynamicController/Index method.