Click here to Skip to main content
Email Password   helpLost your password?

Introduction

This is version 3.0 of the VsCustomRenderer control. You can find previous versions here: 2.0 and 1.0.

Background

This project was inspired by an article on code-project written by dev2dev: Article
Parts of the code were taken from that project.

Using the code

To test this control:

<add verb="*" path="*.jpg" type="VSCustomRendererLibrary.VsImageHandler, 
VSCustomRendererLibrary"/>

If you cannot find this section in your webconfig file, just create it under <system.web>:

<system.web>
    ......
     <httpHandlers>
          <add verb="*" path="*.jpg" type="VSCustomRendererLibrary.VsImageHandler, 
VSCustomRendererLibrary"/>
     </httpHandlers>
</system.web>

Points of Interest

This webcontrol now works with Ajax.
This controls no longer saves images to disk in order to display them. The pictures are displayed directly from memory through a IHttpHandler.
This http handler does not open a new database connection, it just displays the images from memory so there are no delays in page rendering and no extra parameters to set.

History

All the versions of this control are also posted on codeplex.

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
QuestionFailure
vferrava
12:09 29 Jul '08  
While this works fine in Visual Studio, when I turn it over to my IIS server, I get the classic white box with the red X instead of the image. The properties shows the address as: http:\\myIISserver\ 1.jpg?idimg=1 file but the Type is Not Available and the immage does not display. The win.config has been updated. What am I missing?
AnswerRe: Failure
eduguesser
10:44 31 Jul '08  
With me hapens the same in VS this works fine but in my IIS the image don't open

What Can i do to solve this problem?
GeneralRe: Failure
FF77
2:53 9 Nov '08  
In IIS, you will have to associate the .jpg extension with the aspnet_isapi.dll (copy from .aspx extension).
GeneralAlternative
VitalyTomilov
11:51 5 Jul '08  
I used a different method a while back, using XSL embedded objects.

Simply use XSL document with method reference/query that pulls out the pictures from the database, so they get automatically inserted into the resulting document during transformation.
GeneralRe: Alternative
FF77
11:58 5 Jul '08  
I guess it can be done that way too, but I prefer to use the results from the SQL Datasource directly without any processing.
GeneralRe: Alternative
HoyaSaxa93
14:13 5 Jul '08  
Vitaly,

Can you show us an example of this? ...or post a link to an Example?

Thanks in advance.
GeneralRe: Alternative [modified]
VitalyTomilov
2:46 6 Jul '08  
It was the code i did 3 years ago, don't have it anymore, but the idea was simple...

You have an ASP.NET project, plus a database that stores pictures

First, you design a simple class (consider C#) that has one method: Picture GetMyPicture(record ID),
that returns a picture object from the database usig the recrd ID.

Now, you have an XSLT file with Microsoft extensions in it, which means:
1. In the header of XSLT you specify a reference to your C# class
2. Where you normally have tags for data transformation, you use reference to the method with current ID parameter.

Since it is a picture object, the piece in your XSLT would look like <img src="meta-reference-to the method" ...="">

Then you pull pull data from the database as XML, and execute the transformation. That's all.

Here's one example: http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=64

There are plenty others you can find.

modified on Sunday, July 6, 2008 5:02 PM
</img>
GeneralRe: Alternative
FF77
3:12 6 Jul '08  
This is exactly what I was trying to avoid, writing classes and customizing code for each database.
Why do this when you can simply bind the control to a data source and the control does the rest? I generally try to avoid scratching my left ear with my right hand Big Grin .
GeneralRe: Alternative
VitalyTomilov
12:01 6 Jul '08  
Note, i did not call it a better alternative Wink

And besides, i did it 3 years ago. Things change..


Last Updated 5 Jul 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010