473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Dynamic Images in C#

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
3 1357
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: K | last post by:
I have found a script online that I want to use (I am new to PHP). It creates dynamic images based on the text that you pass it. However, no matter how I try, I can't get anything other than a...
3
by: JOSEPHINE ALVAREZ | last post by:
I have this code that I want to use to do a rollover. However, because the company I am doing it for is continually changing the text, I want to be able to use dynamic text to change the text on...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
1
by: richardgroen | last post by:
Hi all, I got one brainteaser (well...for me). I have a database with, lets say 100 images, these images are 'dynamic' e.g. it can be 100 but also 151 images. My question is: How can i...
3
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi! This discussion may help other programmers get a better idea of how to save uploaded images through a website. Why? Well currently, I save 3 versions of every uploaded image on my own...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.