By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,779 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,779 IT Pros & Developers. It's quick & easy.

Dynamic Images in C#

P: n/a
I Have a C# asp app that returns an image to the browser (I'm using IE6) as
follows:

Response.ContentType="image/jpeg";
bmp.Save(Response.OutputStream,System.Drawing.Imag ing.ImageFormat.Jpeg);

However, when I right click on the resulting image in the browser window to
"Save Picture As..." it is saving the calling webform.aspx file (a text
document)...

The result.aspx file contains only the following:

<%@ Page language="c#" AutoEventWireup="false" Codebehind="Result.aspx.cs"
Inherits="spc.Result" %>

I have noticed that if I change the encoding (i.e., right click in the
browser, and selecting any encoding method other than what is current, I can
right click and save the jpeg image (defaults to Result.jpg). But... I
don't want users to have to go through that...

I can set as Background (windows desktop) image from the browser... (w/o
changing the encoding), but emailing the image from the browser prepares an
email containing some funkified version of the calling webform.aspx.

Any ideas?

--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Martin,

I believe that setting the content disposition header will alleviate
this. You can do it like this:

Response.AddHeader("content-disposition", string.Concat("attachment;
filename=", <filename>));

Then, when you right click, it should show the filename you specify, and
save the actual image.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Martin Schmid" <ma**********@sbcglobal.net.nospam> wrote in message
news:On****************@tk2msftngp13.phx.gbl...
I Have a C# asp app that returns an image to the browser (I'm using IE6) as follows:

Response.ContentType="image/jpeg";
bmp.Save(Response.OutputStream,System.Drawing.Imag ing.ImageFormat.Jpeg);

However, when I right click on the resulting image in the browser window to "Save Picture As..." it is saving the calling webform.aspx file (a text
document)...

The result.aspx file contains only the following:

<%@ Page language="c#" AutoEventWireup="false" Codebehind="Result.aspx.cs"
Inherits="spc.Result" %>

I have noticed that if I change the encoding (i.e., right click in the
browser, and selecting any encoding method other than what is current, I can right click and save the jpeg image (defaults to Result.jpg). But... I
don't want users to have to go through that...

I can set as Background (windows desktop) image from the browser... (w/o
changing the encoding), but emailing the image from the browser prepares an email containing some funkified version of the calling webform.aspx.

Any ideas?

--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE

Nov 18 '05 #2

P: n/a
This is causing a pop-up dialog:
'Some files can harm your computer. If the file information below looks
suspicious, or you do not fully trust the source, do not open or save this
file.
File name: <whatever I want>
File type: JPEG Image
From: <this machine>
Would you like to open the file... open/save/cancel/more info...
What can be done to not cause this? I.e., jpeg is typically trustworthy,
no? This shouldn't be raising an alarm on the user's end/
--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uy****************@TK2MSFTNGP12.phx.gbl...
Martin,

I believe that setting the content disposition header will alleviate
this. You can do it like this:

Response.AddHeader("content-disposition", string.Concat("attachment;
filename=", <filename>));

Then, when you right click, it should show the filename you specify, and save the actual image.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Martin Schmid" <ma**********@sbcglobal.net.nospam> wrote in message
news:On****************@tk2msftngp13.phx.gbl...
I Have a C# asp app that returns an image to the browser (I'm using IE6)

as
follows:

Response.ContentType="image/jpeg";
bmp.Save(Response.OutputStream,System.Drawing.Imag ing.ImageFormat.Jpeg);

However, when I right click on the resulting image in the browser window

to
"Save Picture As..." it is saving the calling webform.aspx file (a text
document)...

The result.aspx file contains only the following:

<%@ Page language="c#" AutoEventWireup="false" Codebehind="Result.aspx.cs" Inherits="spc.Result" %>

I have noticed that if I change the encoding (i.e., right click in the
browser, and selecting any encoding method other than what is current, I

can
right click and save the jpeg image (defaults to Result.jpg). But... I
don't want users to have to go through that...

I can set as Background (windows desktop) image from the browser... (w/o
changing the encoding), but emailing the image from the browser prepares

an
email containing some funkified version of the calling webform.aspx.

Any ideas?

--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE


Nov 18 '05 #3

P: n/a
Tools/Internet Options/Security/Custom level.

Some settings are set to Prompt. Check it out.
--

Henri Leboeuf
Web page: http://www.colba.net/~hlebo49/index.htm
===

"Martin Schmid" <ma**********@sbcglobal.net.nospam> wrote in message
news:e4**************@tk2msftngp13.phx.gbl...
This is causing a pop-up dialog:
'Some files can harm your computer. If the file information below looks
suspicious, or you do not fully trust the source, do not open or save this
file.
File name: <whatever I want>
File type: JPEG Image
From: <this machine>
Would you like to open the file... open/save/cancel/more info...
What can be done to not cause this? I.e., jpeg is typically trustworthy,
no? This shouldn't be raising an alarm on the user's end/
--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:uy****************@TK2MSFTNGP12.phx.gbl...
Martin,

I believe that setting the content disposition header will alleviate
this. You can do it like this:

Response.AddHeader("content-disposition", string.Concat("attachment;
filename=", <filename>));

Then, when you right click, it should show the filename you specify,

and
save the actual image.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Martin Schmid" <ma**********@sbcglobal.net.nospam> wrote in message
news:On****************@tk2msftngp13.phx.gbl...
I Have a C# asp app that returns an image to the browser (I'm using IE6)
as
follows:

Response.ContentType="image/jpeg";
bmp.Save(Response.OutputStream,System.Drawing.Imag ing.ImageFormat.Jpeg);
However, when I right click on the resulting image in the browser window
to
"Save Picture As..." it is saving the calling webform.aspx file (a tex
t document)...

The result.aspx file contains only the following:

<%@ Page language="c#" AutoEventWireup="false"

Codebehind="Result.aspx.cs" Inherits="spc.Result" %>

I have noticed that if I change the encoding (i.e., right click in the
browser, and selecting any encoding method other than what is current, I can
right click and save the jpeg image (defaults to Result.jpg). But...
I don't want users to have to go through that...

I can set as Background (windows desktop) image from the browser... (w/o changing the encoding), but emailing the image from the browser

prepares an
email containing some funkified version of the calling webform.aspx.

Any ideas?

--
Thanks,
Martin Schmid, EIT, CCSA, MCDBA, MCSE




Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.