Last post Feb 03, 2010 04:53 AM by sirdneo
Feb 02, 2010 09:07 AM|FoolongC|LINK
Was wondering which is faster:
imageFromGeneric.ImageUrl = "~/ImageHandler.ashx"; ---->
context.Response.ContentType = "image/png";
imageFromGeneric.ImageUrl = "~/images/btn_go.png";
Is is worth it to create handlers (with extra code to maintain) assuming you're going to store images in a folder (I can see the need/advantage of handlers if you're storing images in a database).
Feb 02, 2010 10:52 AM|ignatandrei|LINK
The handler adds an extra step.
If you do not want to see how many times a image is displayed, just put the link to your files!
Feb 03, 2010 04:53 AM|sirdneo|LINK
imageFromGeneric.ImageUrl = "~/images/btn_go.png"; would be faster because there is no extra handler used in this case.
Incase of images consider a case that you have employee personal images and you do not want any other employee to see anyone's image. I.e. employee A can not view the image of Employee B.
if you store those images in ~/Images/EmpA.png, and EmpB.png then botht the employees can access images through URL. i.e. they can type something like this in their browser to view images
If you want to prevent user b to access this URL then you can write a custom handler. And in handler you can add appropriate checks to disable image for other employees.
Hope you understand.