I have two projects (Project A and Project B), these projects are hosted in different locations and on different servers. Project B want to access the files of Project A. Can any one suggest me which technique is required to fulfill my requirements.
A:
It sounds like the project will be sharing files as resources, rather than source code.
It's not clear why the files aren't shared outright(accessible directly by URL), and what security measures need to be taken.
Suggest that Project A share its files/resources by using a new action method. Project B simply will call into Project A by URL. Perhaps: http://ServerA/ProjectA/GetFile/Foo.txt
Consider writing an action method in your MVC project who'll be sharing those files.
public FileResult GetFile(string fileNAme)
{
//serve the file requested
}
Here's a method that'll return an image.
public FileResult Image() {
string path = Server.MapPath("/Content/Images/Decorative/");
string filename = Request.Url.Segments[Request.Url.Segments.Length - 1].ToString();
// Uss Path.Combine from System.IO instead of StringBuilder.
string fullPath = Path.Combine(path, filename);
return(new FileResult(fullPath, "image/jpeg"));
}
p.campbell
2010-08-18 13:36:55