HttpHandler

L

Liming

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
 
S

Steven Cheng[MSFT]

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.)
 
L

Liming

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.
 
S

Steven Cheng[MSFT]

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.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top