Reputation: 4084
How do you calculate a relative path in ASP.NET MVC?
Upvotes: 4
Views: 10188
Reputation: 22485
also, if you want the relative path inside your controller, you can use:
string pathName = VirtualPathUtility.ToAbsolute(string.Format(@"~/images/PhotoAlbum/{0}/", propertyId));
or:
string pathName = VirtualPathUtility.ToAppRelative(string.Format(@"~/images/PhotoAlbum/{0}/", propertyId));
depending on your need..
hope this helps.
Upvotes: 14
Reputation: 5916
To include an image or a script or any other file this is the code:
<script src="<%= Url.Content("~/Scripts/tiny_mce/jquery.tinymce.js") %>" type="text/javascript"></script>
Upvotes: 4