Amazon S3バケットからリモートイメージをロードして、バイナリでブラウザーに送信しようとしています。同時にASP.Netも学ぼうとしています。私は何年もの間古典的なプログラマーであり、変える必要があります。私は昨日始めて、今日最初の頭痛がします。
私のアプリケーションのページには、次の画像要素があります。
<img src="loadImage.ashx?p=rqrewrwr">
そしてloadImage.ashxに、私はこの正確なコードを持っています:
-------------------------------------------------
<%@ WebHandler Language="C#" Class="Handler" %>
string url = "https://............10000.JPG";
byte[] imageData;
using (WebClient client = new WebClient()) {
imageData = client.DownloadData(url);
}
public void ProcessRequest(HttpContext context)
{
context.Response.OutputStream.Write(imageData, 0, imageData.Length);
}
-------------------------------------------------
これは.netでの最初の試みであり、私が何をしているのかわからないため、おそらくこれにはかなりの間違いがあります。まず、次のエラーが発生しますが、まだまだあります。
CS0116: A namespace does not directly contain members such as fields or methods
これは3行目です。string url = "https://............"