Last post Jan 08, 2007 10:10 PM by Pure Krome
Jan 07, 2007 02:38 AM|Pure Krome|LINK
i've made a simple handler that takes in a giud (asp.net membership guid) and then returns an avatar joined to the guid account.
eg. < img src = "~/blah.img" ... / >
Works, fine, etc.
When it comes to the actual writing of the byte back to the client we have TWO options to use.
is it bad to use BinaryWrite to dump the image data back to the user? The reason i'm asking is that i would prefer NOT to store the content type of the uploaded avatar image ... but if i have to then i will if the outputstream method is better.
Outputstream i think also requires the use of the Reponse.ContentType property getting set (eg. "image/png").
HttpHandler BinaryWrite OutputStream
Jan 07, 2007 12:14 PM|mbanavige|LINK
Response.BinaryWrite actually calls to OutputStream.Write - so essentially they are the same...
For either method, you should set the proper contenttype header.
Here is what was viewed from
Reflector as the source of Response.BinaryWrite:
Public Sub BinaryWrite(ByVal buffer As Byte())
Me.OutputStream.Write(buffer, 0, buffer.Length)
Jan 08, 2007 10:10 PM|Pure Krome|LINK
heh : ) that's what i'm already doing. doh :)
cheers .. and i don't know why i didn't think of using reflector also ... *blush*