In ASP.Net, how to get the file path in another project?

时间:2015-08-07 01:33:08

标签: asp.net

Currently I have a web project A, it has one button, and the button on-click event will call a function in another project B.

Now within this function, I have to access a file which is under project B, with path like /B/Template/myFile.doc

I have tried to use method like Server.MapPath() and HostingEnvironment.MapPath() in this function, but both method is getting relative path to project A rather than B

I guess indeed it is the correct behavior but how can I get the path of this file in project B successfully? Any help would be appreciated!

1 个答案:

答案 0 :(得分:0)

One way to do it would be:

  1. Import project B into project A.
  2. Write a function in project B that returns the full path to the file.
  3. Call that function in project A.

Hope that helps!