I have a solution file that consist of two different projects.
In one of the projects i have a code to upload the file and save it.

Currently the file is saved in same project directory that consist of code to upload the file.

I want to upload the file in other project directory.

Is it possible.

I am developing the application in asp.net mvc.

Please help

7 Years
Discussion Span
Last Post by nccsbim071

Hello there

If i understand you correcly!!!
suppose you have classes class1 & class2 in each project A & Project B

if you want to use class1 of project A in Project B's class2
Then right click on project 2 >> References>>Add Reference>>"Select Class1 dll of project A"

Then in class 2 of project B inherit like the class1 like this

Imports Project1.Class1


Using Project1.Class1

Mark as solved if it helps you!!!

Edited by reach_yousuf: n/a


the conditon is as you have said. but i have image upload code in a project A, i want to save the uploaded image to folder in projectB.

It's not about class, that i know just adding the reference will do, but this is something different.


Ok i solved the problem:

1. string temp = Server.MapPath(Request.ApplicationPath);
2. string tempPath = Path.Combine(temp.Substring(0, (temp.Length - 21)), "IManageProject\\Images");
3. filePath = Path.Combine(tempPath, Path.GetFileName(fileName));
4. file.SaveAs(filePath);

I i just got the path to the root of the project using the code in line 1.
Then is used the substring on temp variable and got the path to the root and then finally combined it with the path to the folder i wanted.
and save the file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.