开发者

web application architecture

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 fi开发者_如何学Pythonles of Project A. Can any one suggest me which technique is required to fulfill my requirements.


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"));

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜