0
私は2つのサイト、1つのサブドメインを持つ状況にあります。あるサイトが画像をフォルダにアップロードし、その画像への参照を別のサイトからアクセス可能なデータベースに保存します。asp.net mvc:ドメイン間でイメージファイルを共有する方法
私ができる必要があることは、両方のサイトの画像にアクセスすることです。
私は、両方のサイトからアクセスできる、パブリックHTMLフォルダの外にあるフォルダにファイルを保存することを検討しましたが、完全なサーバーパスを示す厄介なsrc属性を使用せずにこれらのイメージを参照する方法がわかりません。あなたの意見で
public ActionResult Image(int id)
{
var image = ... go and fetch the image information from the database (you will need the path to the image on the server and the content type)
string path = image.Path; // could be any absolute path anywhere on your server, for example c:\foo\bar.jpg
string contentType = image.ContentType; // for example image/jpg
return File(path, contentType);
}
、その後:
おかげ
素敵な、それをやろう! – Sergio