Deploying ASP.NET MVC App to Multiple Virtual Directories (Issues with URL references & JS files)?

You might consider creating controllers to return FileResult s for static content (css, js, etc) that encapsulates the paths.

You might consider creating controllers to return FileResult's for static content (css, js, etc) that encapsulates the paths.

. Hmm... I'll think about this one a little longer and see. -thanks – DaveDev Feb 9 '10 at 14:54 Yeh I was stabbing i'll admit.

I've been considering doing this for other reasons but I thought it might apply. – cottsak Feb 9 '10 at 15:51.

When making references to files from a View in MVC, I always use this Since View refferences are relative to the resource requesting them, using this bit of Javascript in your master page can help if you need "relative" paths inside your . JS files. And finally, CSS works just fine, since all paths in CSS are relative to the location of the .

Css file.

Good answer.. I didn't know about Url.Content(). It makes sense. I think I'll stick with the Html.MyJavaScript() solution though becuase 1.It allows for cleaner code, and 2.

I'm too lazy to change it! :-) – DaveDev Feb 10 '10 at 16:59 What you have will work just as well, I only posted as an alternate solution for those who find this down the road. – Nate Feb 10 '10 at 17:29.

Ok, in the end it turned out the solution is this: with the following definition for the first example above public static string JavaScriptTag(this HtmlHelper htmlHelper, string fileName) { TagBuilder js = new TagBuilder("script"); string path = VirtualPathUtility. ToAbsolute("~/Scripts/" + fileName); js. MergeAttribute("src", path); js.

MergeAttribute("type", "text/javascript"); return js.ToString(); } these HtmlHelpers are fantastic!

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions