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 6809887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:08:21+00:00 2026-05-26T20:08:21+00:00

When i am displaying image from folder using Handler.ashx ans then try to save

  • 0

When i am displaying image from folder using Handler.ashx ans then try to save the image by right clicking it it keeps giving me the option of “Save as type” asp.net generic handler and the handler name as the File name..

Bitmap target = new Bitmap(width, height);
    using (Graphics graphics = Graphics.FromImage(target)) {
        graphics.CompositingQuality = CompositingQuality.HighSpeed;
        graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
        graphics.CompositingMode = CompositingMode.SourceCopy;
        graphics.DrawImage(photo, 0, 0, width, height);
        using (MemoryStream memoryStream = new MemoryStream()) {
            target.Save(memoryStream, ImageFormat.Png);
            OutputCacheResponse(context, File.GetLastWriteTime(photoPath));
            using (FileStream diskCacheStream = new FileStream(cachePath, FileMode.CreateNew))
            {
                memoryStream.WriteTo(diskCacheStream);
            }
            memoryStream.WriteTo(context.Response.OutputStream);
        }
    }

above is the handler and

ImageTiff.ImageUrl = "Handler.ashx?p=" + Parameter; 

this is the code behind.

I need to save it with the Image name ans not as the handler.ashx

  • 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-05-26T20:08:22+00:00Added an answer on May 26, 2026 at 8:08 pm
              context.Response.ContentType = "image/pjpeg"; 
              context.Response.AddHeader("Content-Disposition", "attachment; filename=\"" + photoName  + "\"");
    
              OutputCacheResponse(context, File.GetLastWriteTime(photoPath));
    
               context.Response.Flush();
    
    
               using (FileStream diskCacheStream = new FileStream(cachePath, FileMode.CreateNew))
               {
                   memoryStream.WriteTo(diskCacheStream);
               }
                memoryStream.WriteTo(context.Response.OutputStream);
    

    A good night sleep and your help did the trick i guess 🙂 Thanks guys !

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

friends, i have a page on which i am displaying image from gallery then
I'm displaying an image (from a file) on the browser using html... I have
When i'm displaying image from url with using below code, application is taking too
Am having some difficulty getting an Image from a url, and then displaying it
I'm having trouble with displaying image from db. I think that method for saving
How can I prevent the image tag that calls the associated image from displaying
My app has to load an image from a http server and displaying it
I'm displaying images from outside my web root, like this: header('Content-type:image/png'); readfile($fullpath); The content-type:
I am having trouble displaying an image from the internet on my html page.
I am trying to retrieve an image from an Embedded resource, and displaying it

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.