Getting path to subproject's Content folder

1.2k Views Asked by At

Currently I have a main (root) ASP.NET MVC project that sits at the base, while all the subprojects are added as references. I'd like to use the subproject's Content folder, but unfortunately Server.MapPath, and Content.Url keeps giving me the root project's Content folder, and not the subproject's Content folder (which is where the items are output to).

I've searched quite a bit around Stack Overflow but it seems that majority of the people are trying to find the path to the main project, which is not what I want. I'm calling this method from one of the subproject's Controllers.

1

There are 1 best solutions below

0
On

You can give a url of sub project like this

filename = Path.GetFileName(file.FileName);

destinationPath = Path.Combine(Server.MapPath("~/Images/"), filename);

string url = "http://localhost:4334/ImageUpload/ImageUploadSub/?imagename=" + filename + "&imagepath=" + destinationPath;