Click here to Skip to main content
14,302,135 members

Retrieve more than one image on a page along with other contents using http handler (ashx)

6,921,364 and growing asked:

Open original thread
Hi everyone,

Let me explain the scenario.

I have to display a page which will show user's personal information along with his profile picture and signature (after log-in).
The profile picture and signature are stored in database.
I am using 2 Image control on the web page. I am retrieving the image using http handler.
<asp:Image ID="imgUserImage" runat="server" AlternateText="User Photo" Height="130px" Width="150px" />
<br /> <asp:Image ID="imgUserSign" runat="server" AlternateText="User Signature"

Height="40px" Width="150px" />

Now the user id will be obtained at runtime. So I am assigning the url to the image at runtime like this:
//show user image
imgUserImage.ImageUrl = "showUserImage.ashx?imgtype=photo&id=" + empid;
//show user signature
imgUserImage.ImageUrl = "showUserImage.ashx?imgtype=sig&id=" + empid;

Based on the imgtype querystring, the handler is processing the request and will display corresponding image.

Now the problem is, the ProcessRequest method is called only once (after Page_Load of aspx) which I think is correct.
Is there a way I can show both the images on the page using the handler.
I couldn't find a solution on the web. :(

Tags: ASP.NET, image


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100