Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8184555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:32:41+00:00 2026-06-07T01:32:41+00:00

page.aspx.cs code: HttpContext.Current.Session[id1] = id1.ToString(); Server.Transfer(Handler.ashx); //Getting error Image1.ImageUrl = ~/Handler.ashx?ID= + id1.ToString(); HttpContext.Current.Session[id2]

  • 0

page.aspx.cs code:

HttpContext.Current.Session["id1"] = id1.ToString();
Server.Transfer("Handler.ashx"); //Getting error
Image1.ImageUrl = "~/Handler.ashx?ID=" + id1.ToString();

HttpContext.Current.Session["id2"] = id2.ToString();
Server.Transfer("Handler.ashx"); //Getting error
Image2.ImageUrl = "~/Handler.ashx?ID=" + id2.ToString();

Handler.ashx code:

public void ProcessRequest(HttpContext context)
{
    int id = Convert.ToInt32(context.Session["id1"]);
    byte[] IMG = class.ReadImg(id);
    context.Response.ContentType = "image/jpg";
    context.Response.BinaryWrite(IMG);
}
public void ProcessRequest2(HttpContext context2)
{
    int id = Convert.ToInt32(context2.Session["id2"]);
    byte[] IMG2 = class.ReadImg(id);
    context2.Response.ContentType = "image/jpg";
    context2.Response.BinaryWrite(IMG2);
}

page.aspx code:

<asp:Image ID="Image1" runat="server" />//How to define thats gonna show image of id1
<asp:Image ID="Image2" runat="server" />//How to define thats gonna show image of id2

Question:

  1. I’m not able to transfer data from page.aspx to Handler.ashx
  2. I dont know how to make Image element to identify which image it should show according to the id (maybe some request.queryString magic I don’t understand)

Help!!
Thanks :]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:32:44+00:00Added an answer on June 7, 2026 at 1:32 am

    Server.Transfer() does what it says – transfer the request on the server-side, without returning a HTTP 301 re-direct to the client.

    Your problem can be solved by simply reading the querystring in the ashx file:

    string id = context.Request.Querystring["ID"];
    context.Response.ContentType="image/jpeg";
    ......
    

    Then in your aspx page:

    Image1.ImageUrl = "/Handler.ashx?ID="+id.ToString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is how my code is: page.aspx: <asp:Image ID=Image1 runat=server /> Code behind: byte[]
I want to create a Dynamic aspx Page in current solution through code-behind..forexample i
When a user logs in, my code sets a Session variable using System.Web.HttpContext.Current.Session[customer_ref] ,
how can i write this code from aspx page in code behind? <a href=skype:MySkype?call><img
Let's assume my ASPX page has no inline C# code blocks. So, I can
I have following code. ASPX Page <a href=AnyASPXPageOfWebsite.aspx onclick=javascript:CallJQuery(); > Set Price </a> JS
I'm working at the aspx page, and the following code is inserted in a
I have a Login.aspx page, and I wanna incude some piece of code in
I have an ASP.NET page with code-behind in VB.NET. On the ASPX page I
How can I get the url of the active aspx page from the code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.