[ASP.NET 4.0 Visual Studio 2010]
こんにちは、私は ASP.NET を初めて使用し、次のことを試みています。
サーバー側のイメージ コントロールが Image1.ImageUrl = "~/ImageHandle.ashx" のように参照できるように、ジェネリック ハンドラーを作成します。
画像ファイルの名前 (jpeg) であるクエリを使用して、Dropbox アカウント内のファイルの名前を渡します。
画像を回転させて、呼び出し元のコードに返します。
しかし、私は本当に新しく、これが私が持っているすべてです。何が間違っているのかわかりません。
Public Class ImageHandle
Implements System.Web.IHttpHandler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim imgurl As String = "https://dl.dropbox.com/u/134313/Duel%20Portal%20Info/Images/" & context.Request("file").Replace("_", "%20") 'Number Changed for privacy reasons
context.Response.ContentType = "image/jpeg"
Dim img As System.Drawing.Image = Nothing
Dim webc As New Net.WebClient, theBytes() As Byte
Try
theBytes = webc.DownloadData(imgurl)
img = Byte2Image(theBytes)
img = Rotate90Degrees(img)
Catch ex As Exception
End Try
img.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
End Class
画像が表示されないだけです。ImageHandle はブレークポイントにまったくヒットしません。
また、web.config をフォーマットしてこれを含める方法もわかりません。助けていただければ幸いです。
編集:これはこれまでのところ私の Web.Config です。まだ動作していません!!助けてください!
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<handlers>
<add name="ImageHandle" path="~/ImageHandle.ashx" verb="*"/>
</handlers>
</system.webServer>