I did not find a way to do this with mvc routing, which I ended up with: I ran this code in the http module:
void context_BeginRequest(object sender, EventArgs e) { HttpApplication Application = sender as HttpApplication; var match = r.Match(Application.Request.Url.AbsolutePath); if (match.Success) { var fileName = match.Groups[2].Value; Application.Context.RewritePath("/" + fileName); } }
r is a regular expression in my case:
private readonly Regex r = new `Regex("^/gmail(/canvas)?/((content|scripts|images|tinymce).*)$", RegexOptions.IgnoreCase);`
in global.asax I added:
routes.IgnoreRoute("{*staticfile}", new { staticfile = @".*\.(css|js|gif|jpg)(/.*)?" });
to prevent mvc.net from routing these requests.
it may also be necessary to install iis6 / iis7 to route requests to static files via mvc.net, but I forgot the details.
I chose this method from several posts that I donβt remember, so I apologize for not being able to give the proper credit.
source share