473,383 Members | 1,866 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,383 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 16 '05 #1
3 1853
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 16 '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 16 '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 16 '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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.