イメージを 2 つのアプリケーション (両方ともサーバー上で公開) に保存しようとしています。これは、画像を保存するための私のコードです:
string path = Server.MapPath("/Images/Landing/bottom_banner/");
string path1 = @"_http://10.241.193.22/Myapplication/Images/Landing/bottom_banner/";
HttpPostedFileBase photo = Request.Files["adup"];
if (photo.ContentLength != 0)
{
string lastPart = photo.FileName.Split('\\').Last();
Random random = new Random();
int rno = random.Next(0, 1000);
photo.SaveAs(path + rno + lastPart);
photo.SaveAs(path1 + rno + lastPart);
}
注:Myapplication
同じサーバーでホストされている別のアプリケーションです
私の問題は、最初のアプリケーションで画像を保存できることですがServer.MapPath
、コンパイラがその部分 photo.SaveAs(path1 + rno + lastPart)
に来るとエラーが発生します:
SaveAs メソッドはルート化されたパスを要求するように構成されており、パス '_http://10.241.193.22/Myapplication/Images/Landing/bottom_banner/676Chrysanthemum.jpg' はルート化されていません
この問題を解決するにはどうすればよいか教えてください。