Can't use relative paths with areas in ASP.NET MVC 2 -
In my application, I have a field mobile. In this area, I have a folder call assets where we have all our CSS, Javascript And insert images.
The use of ideas works just fine.
The problem is that when I use my CSS, Javascript and images.
I can not do anything in my view like this.
& lt; Img Src = "Property / CSS / Stylus CSS" />
The reason is that the real URL is:
Is there any way to map to static files?
Thanks, Randall
This is the method I applied for the BeginRequest event.
Zero BeginRequest (Object Sender, EventArgs e) {var reference = HttpContext.Current; Var path = context.Request.Path; // Add field to the mobile path, so we do not need to manually specify it. // This is mainly for handling static resources which you keep in areas. If (! Path contains ("mobile /"); If (path.EndsWith (".png") || path.EndsWith (".gif") || Path (edit ".css") || Path (editing ".js") || Path (edit. With ".htm") path. Edit (".cache")) reference. Rewrite path (route. Replay ("mobile /", "area / mobile /"); }
Comments
Post a Comment