0

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.

VLAZ
  • 26,331
  • 9
  • 49
  • 67
matt
  • 2,857
  • 7
  • 33
  • 58
  • [link](http://stackoverflow.com/questions/16009891/how-can-i-use-server-mappath-inside-class-library-project) hope this helps – MustangManiac Jun 02 '14 at 17:40
  • Have you defined your subprojects as their own web applications with their own worker processes in IIS? or are they just in folders? – Erik Funkenbusch Jun 02 '14 at 21:32

1 Answers1

1

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;
VLAZ
  • 26,331
  • 9
  • 49
  • 67
Cuteboy_Max
  • 131
  • 1
  • 4