You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a class that implements the IHttpHandler interface. You implement the ProcessRequest method by using the following code segment. (Line numbers are included for reference only.)
01 Public Sub ProcessRequest(ctx As HttpContext)
02
03 End Sub
You need to ensure that the image named Alert.jpg is displayed in the browser when the handler is requested.
Which code segment should you insert at line 02?
A.
Dim sr As New StreamReader(File.OpenRead(ctx.Server.MapPath("Alert.jpg")))
ctx.Response.Pics(sr.ReadToEnd())
sr.Close()
B.
Dim sr As New StreamReader(File.OpenRead(ctx.Server.MapPath("Alert.jpg")))
ctx.Response.Pics("image/jpg")
ctx.Response.TransmitFile(sr.ReadToEnd())
sr.Close()
C.
ctx.Response.ContentType = "image/jpg"
Dim fs As FileStream = File.OpenRead(ctx.Server.MapPath("Alert.jpg"))
Dim b As Integer
While (InlineAssignHelper(b, fs.ReadByte())) <> -1
ctx.Response.OutputStream.WriteByte(CByte(b))
End While
fs.Close()
D.
ctx.Response.TransmitFile("image/jpg")
Dim fs As FileStream = File.OpenRead(ctx.Server.MapPath("Alert.jpg"))
Dim b As Integer
While (InlineAssignHelper(b, fs.ReadByte())) <> -1
ctx.Response.OutputStream.WriteByte(CByte(b))
End While
fs.Close()