HttpHandler

Discussion in 'ASP .Net' started by Liming, Apr 4, 2006.

  1. Liming

    Liming Guest

    Hi,

    I have a HttpHandler (Thumbnail.axd) that output Thumbnail images). The
    problem is that all the output images being gerneated in the browser all
    takes the same name "Thumbnail.axd.gif"

    How do you make the httphandler so that it outputs a name base on a
    parameter I pass in like so... "Thumbnail.axd?filename=myname"?

    Thanks
     
    Liming, Apr 4, 2006
    #1
    1. Advertising

  2. Hi Liming,

    Welcome to the ASPNET newsgroup.

    As for the httphandler, it just write out certain response stream to the
    client browser, for image, the returned stream just contains the image's
    binary data. Actually, there is no filename info for the httphandler
    generated image stream. What's your detailed scenario, are you using
    webbrowser to save the image to client machine's file disk? If so, the
    client user need to manually change the filename as whatever value he
    wants.

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Apr 4, 2006
    #2
    1. Advertising

  3. Liming

    Liming Guest

    Thanks again Steve.

    Actually, from the ASP.NET forum, someone suggested this

    string disheader = "inline; filename=\"" + myinfo.FileName + "\"";

    HttpContext.Current.Response.AppendHeader("Content-Disposition", disheader);

    and this works.. but seems like in IE, not always, though my IE 6.0 works
    really well against this Content-Disposition header.



    "Steven Cheng[MSFT]" <> wrote in message
    news:X%23$...
    > Hi Liming,
    >
    > Welcome to the ASPNET newsgroup.
    >
    > As for the httphandler, it just write out certain response stream to the
    > client browser, for image, the returned stream just contains the image's
    > binary data. Actually, there is no filename info for the httphandler
    > generated image stream. What's your detailed scenario, are you using
    > webbrowser to save the image to client machine's file disk? If so, the
    > client user need to manually change the filename as whatever value he
    > wants.
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Community Support
    >
    >
    > ==================================================
    >
    > When responding to posts, please "Reply to Group" via your newsreader so
    > that others may learn and benefit from your issue.
    >
    > ==================================================
    >
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
    >
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
     
    Liming, Apr 4, 2006
    #3
  4. Thanks for your response Liming.

    Yes, the "Content-Disposition" header can specify filename info, however,
    mostly it is used for attachement download. e.g:

    context.Response.ContentType = "image/gif";
    context.Response.AddHeader("Content-disposition", "attachment;
    filename=myimage.gif");


    This can make the popup filedownload dialog and the save file dialog
    display the filename.

    Regards,

    Steven Cheng
    Microsoft Online Community Support


    ==================================================

    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.

    ==================================================


    This posting is provided "AS IS" with no warranties, and confers no rights.



    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Apr 5, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David J. Berman

    Re: HttpHandler for images and browser behavior

    David J. Berman, Jun 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    3,163
    David J. Berman
    Jun 24, 2003
  2. Lloyd Dupont

    HttpHandler not working :-)

    Lloyd Dupont, Jul 14, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    483
    Lloyd Dupont
    Jul 14, 2003
  3. Lloyd Dupont

    Re: HttpHandler not working :-)

    Lloyd Dupont, Jul 14, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    757
    Lloyd Dupont
    Jul 15, 2003
  4. Peter Rilling
    Replies:
    4
    Views:
    417
    Peter Rilling
    Aug 4, 2003
  5. Peter Rilling
    Replies:
    1
    Views:
    530
    Dhananjay Modak
    Aug 5, 2003
Loading...

Share This Page