I'm in a button clicked event on mainpage.aspx. I want to display a new
webpage that has just my image, which is a jpg. I want the page to be a
..jpg not an aspx so that it will be easy for the user to save to disk.
How can I do this?
Thanks,
T 11 3481
Hi,
change the ContentType and write the jpeg.
Response.Conten tType = "image/jepg"
...
oBmp = New Bitmap(strPath)
...
oBmp.Save(Respo nse.OutputStrea m,
System.Drawing. Imaging.ImageFo rmat.Jpeg)
Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
there are two pages involved, webform1.aspx and HiRes.aspx. In
Webform1.aspx I write a .jpg to the root of d: and do :
Server.Transfer ("HiRes.aspx ")
HiRes.aspx is as follows:
<%@ Page Language="vb" ContentType="im age/jpeg" AutoEventWireup ="false"
Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>test</title>
<meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1">
<meta name=vs_default ClientScript content="JavaSc ript">
<meta name=vs_targetS chema
content="http://schemas.microso ft.com/intellisense/ie5">
</head>
<body MS_POSITIONING= "GridLayout ">
<form id="Form1" target="_blank" method="post" runat="server">
</form>
</body>
</html>
and the CodeBehind for hires.aspx is as follows:
Imports System.Drawing. Imaging
Public Class HiRes
Inherits System.Web.UI.P age
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Response.Clear( )
Dim oBmp As Bitmap
oBmp = New Bitmap("d:\bigp ic.jpg")
oBmp.Save(Respo nse.OutputStrea m, imageformat.jpe g)
Response.End()
End Sub
End Class
What happens is that the picture does indeed get written but to
webform1.aspx. What was in webform1.aspx is completely replaced by just the
image. You might notice that I put Target="_blank" in an attempt to get it
to display a new i.e. page.
Thanks,
T
"Jerry III" <je******@hotma il.com> wrote in message
news:uL******** ******@TK2MSFTN GP10.phx.gbl... What does it come as? You're clearly telling the client that it's an image/jpeg and you're saving it as such and I'm doing this all the time
and it works just fine. Could you be more specific? Maybe you're saving more than the image to the response or you're not setting the headers right...
Jerry
"Tina" <ti**********@e xcite.com> wrote in message news:uz******** ******@TK2MSFTN GP10.phx.gbl... Natty, That doesn't come through to the client browser as a .jpg and is there fore either impossible or very difficult for them to save the file as a .jpg. I do this all the time from static pages but can't seem to make it work
from aspx pages and vb.net code. Thanks, T "Natty Gur" <na***@dao2com. com> wrote in message news:e1******** *****@TK2MSFTNG P11.phx.gbl... Hi,
change the ContentType and write the jpeg. Response.Conten tType = "image/jepg" .. oBmp = New Bitmap(strPath) .. oBmp.Save(Respo nse.OutputStrea m, System.Drawing. Imaging.ImageFo rmat.Jpeg)
Natty Gur, CTO Dao2Com Ltd. 34th Elkalay st. Raanana Israel , 43000 Phone Numbers: Office: +972-(0)9-7740261 Fax: +972-(0)9-7740261 Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
You dont set the content header :
Response.Conten tType = "image/jepg"
Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Tina,
this is completely wrong. You're trying to send a jpeg image from Hires.aspx
yet you're sending HTML tags to the response. If you want to do that there
should be nothing (and I mean nothing) in the page except page directives
and server side script. In your case (using code behind) only the single
Page directive should be in your aspx file, like this:
<%@ Page Language="vb" ContentType="im age/jpeg" AutoEventWireup ="false"
Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %>
Anything else (such as your HTML in it) will be sent down to the client
effectively breaking your jpeg image data. Of course a cleaner way is to
send it through a render function instead of in OnLoad event but from the
functionally point of view it doesn't matter.
BTW why do you create a file on your disk drive and then send it? Wouldn't
it be easier to send it directly without writing it to the drive?
Jerry
"Tina" <ti**********@e xcite.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. there are two pages involved, webform1.aspx and HiRes.aspx. In Webform1.aspx I write a .jpg to the root of d: and do : Server.Transfer ("HiRes.aspx ")
HiRes.aspx is as follows: <%@ Page Language="vb" ContentType="im age/jpeg" AutoEventWireup ="false" Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>test</title> <meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1"> <meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1"> <meta name=vs_default ClientScript content="JavaSc ript"> <meta name=vs_targetS chema content="http://schemas.microso ft.com/intellisense/ie5"> </head> <body MS_POSITIONING= "GridLayout ">
<form id="Form1" target="_blank" method="post" runat="server">
</form>
</body> </html>
and the CodeBehind for hires.aspx is as follows:
Imports System.Drawing. Imaging Public Class HiRes Inherits System.Web.UI.P age
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load Response.Clear( ) Dim oBmp As Bitmap oBmp = New Bitmap("d:\bigp ic.jpg") oBmp.Save(Respo nse.OutputStrea m, imageformat.jpe g) Response.End() End Sub End Class
What happens is that the picture does indeed get written but to webform1.aspx. What was in webform1.aspx is completely replaced by just
the image. You might notice that I put Target="_blank" in an attempt to get
it to display a new i.e. page. Thanks, T "Jerry III" <je******@hotma il.com> wrote in message news:uL******** ******@TK2MSFTN GP10.phx.gbl... What does it come as? You're clearly telling the client that it's an image/jpeg and you're saving it as such and I'm doing this all the time and it works just fine. Could you be more specific? Maybe you're saving more than the image to the response or you're not setting the headers
right... Jerry
"Tina" <ti**********@e xcite.com> wrote in message news:uz******** ******@TK2MSFTN GP10.phx.gbl... Natty, That doesn't come through to the client browser as a .jpg and is there fore either impossible or very difficult for them to save the file as a
..jpg. I do this all the time from static pages but can't seem to make it work
from aspx pages and vb.net code. Thanks, T "Natty Gur" <na***@dao2com. com> wrote in message news:e1******** *****@TK2MSFTNG P11.phx.gbl... > Hi, > > change the ContentType and write the jpeg. > Response.Conten tType = "image/jepg" > .. > oBmp = New Bitmap(strPath) > .. > oBmp.Save(Respo nse.OutputStrea m, > System.Drawing. Imaging.ImageFo rmat.Jpeg) > > Natty Gur, CTO > Dao2Com Ltd. > 34th Elkalay st. Raanana > Israel , 43000 > Phone Numbers: > Office: +972-(0)9-7740261 > Fax: +972-(0)9-7740261 > Mobile: +972-(0)58-888377 > > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it!
Jerry,
The problem is:
First, the desired solution is...
The user is interacting with Webform1.aspx. A button on that form should
bring up a new browser window where the url is a .jpg and the image is
displayed in that new browser window. Because the url is a .jpg, the user
can easily save it to his local disk. He can then continue interacting with
webform1, bringing up new pictures and saving them as desired.
What is happening is...
when the user hit's the button on Webform1, everything on webform1 is wiped
out and replaced by the hi res picture. The url still says www.mysite.com/myApp/Webform1.aspx. This is all bad because (1) Webform1
got wiped out and user needs to back arrow to continue and (2) the user
can't save the image because the url is not a .jpg.
I think this, coupled with my description below pretty much describes this
problem I am having.
Thanks for bearing with me so far,
T
"Jerry III" <je******@hotma il.com> wrote in message
news:Ow******** ******@tk2msftn gp13.phx.gbl... Take my last message back (well, you should still clean up the page, if you're sending an image then there should be no HTML for clarity).
You're saying that the image renders fine on the client side, what exactly is the problem then?
Jerry
"Tina" <ti**********@e xcite.com> wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. there are two pages involved, webform1.aspx and HiRes.aspx. In Webform1.aspx I write a .jpg to the root of d: and do : Server.Transfer ("HiRes.aspx ")
HiRes.aspx is as follows: <%@ Page Language="vb" ContentType="im age/jpeg" AutoEventWireup ="false" Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>test</title> <meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1"> <meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1"> <meta name=vs_default ClientScript content="JavaSc ript"> <meta name=vs_targetS chema content="http://schemas.microso ft.com/intellisense/ie5"> </head> <body MS_POSITIONING= "GridLayout ">
<form id="Form1" target="_blank" method="post" runat="server">
</form>
</body> </html>
and the CodeBehind for hires.aspx is as follows:
Imports System.Drawing. Imaging Public Class HiRes Inherits System.Web.UI.P age
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load Response.Clear( ) Dim oBmp As Bitmap oBmp = New Bitmap("d:\bigp ic.jpg") oBmp.Save(Respo nse.OutputStrea m, imageformat.jpe g) Response.End() End Sub End Class
What happens is that the picture does indeed get written but to webform1.aspx. What was in webform1.aspx is completely replaced by just the image. You might notice that I put Target="_blank" in an attempt to get it to display a new i.e. page. Thanks, T "Jerry III" <je******@hotma il.com> wrote in message news:uL******** ******@TK2MSFTN GP10.phx.gbl... What does it come as? You're clearly telling the client that it's an image/jpeg and you're saving it as such and I'm doing this all the
time and it works just fine. Could you be more specific? Maybe you're saving
more than the image to the response or you're not setting the headers right... Jerry
"Tina" <ti**********@e xcite.com> wrote in message news:uz******** ******@TK2MSFTN GP10.phx.gbl... > Natty, > That doesn't come through to the client browser as a .jpg and is
there fore > either impossible or very difficult for them to save the file as a .jpg. I > do this all the time from static pages but can't seem to make it
work from > aspx pages and vb.net code. > Thanks, > T > "Natty Gur" <na***@dao2com. com> wrote in message > news:e1******** *****@TK2MSFTNG P11.phx.gbl... > > Hi, > > > > change the ContentType and write the jpeg. > > Response.Conten tType = "image/jepg" > > .. > > oBmp = New Bitmap(strPath) > > .. > > oBmp.Save(Respo nse.OutputStrea m, > > System.Drawing. Imaging.ImageFo rmat.Jpeg) > > > > Natty Gur, CTO > > Dao2Com Ltd. > > 34th Elkalay st. Raanana > > Israel , 43000 > > Phone Numbers: > > Office: +972-(0)9-7740261 > > Fax: +972-(0)9-7740261 > > Mobile: +972-(0)58-888377 > > > > > > *** Sent via Developersdex http://www.developersdex.com *** > > Don't just participate in USENET...get rewarded for it! > >
Ok, your right. I put that in my code and it made no difference.
Thanks,
T
"Natty Gur" <na***@dao2com. com> wrote in message
news:eg******** ******@tk2msftn gp13.phx.gbl... You dont set the content header :
Response.Conten tType = "image/jepg"
Natty Gur, CTO Dao2Com Ltd. 34th Elkalay st. Raanana Israel , 43000 Phone Numbers: Office: +972-(0)9-7740261 Fax: +972-(0)9-7740261 Mobile: +972-(0)58-888377
*** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
You need to set the target attribute to _blank on your form to open the
image in a new window. Like this:
<form target="_blank" ...>...</form>
Or you can use a link (<a>) with the same attribute.
If I understand you correctly you don't have a problem displaying the image,
right? You just want it to open in a new window?
Jerry
"Tina" <ti**********@e xcite.com> wrote in message
news:un******** ******@TK2MSFTN GP11.phx.gbl... Jerry, The problem is: First, the desired solution is... The user is interacting with Webform1.aspx. A button on that form should bring up a new browser window where the url is a .jpg and the image is displayed in that new browser window. Because the url is a .jpg, the user can easily save it to his local disk. He can then continue interacting
with webform1, bringing up new pictures and saving them as desired.
What is happening is... when the user hit's the button on Webform1, everything on webform1 is
wiped out and replaced by the hi res picture. The url still says www.mysite.com/myApp/Webform1.aspx. This is all bad because (1) Webform1 got wiped out and user needs to back arrow to continue and (2) the user can't save the image because the url is not a .jpg.
I think this, coupled with my description below pretty much describes this problem I am having. Thanks for bearing with me so far, T "Jerry III" <je******@hotma il.com> wrote in message news:Ow******** ******@tk2msftn gp13.phx.gbl... Take my last message back (well, you should still clean up the page, if you're sending an image then there should be no HTML for clarity).
You're saying that the image renders fine on the client side, what
exactly is the problem then?
Jerry
"Tina" <ti**********@e xcite.com> wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. there are two pages involved, webform1.aspx and HiRes.aspx. In Webform1.aspx I write a .jpg to the root of d: and do : Server.Transfer ("HiRes.aspx ")
HiRes.aspx is as follows: <%@ Page Language="vb" ContentType="im age/jpeg"
AutoEventWireup ="false" Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>test</title> <meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1"> <meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1"> <meta name=vs_default ClientScript content="JavaSc ript"> <meta name=vs_targetS chema content="http://schemas.microso ft.com/intellisense/ie5"> </head> <body MS_POSITIONING= "GridLayout ">
<form id="Form1" target="_blank" method="post" runat="server">
</form>
</body> </html>
and the CodeBehind for hires.aspx is as follows:
Imports System.Drawing. Imaging Public Class HiRes Inherits System.Web.UI.P age
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load Response.Clear( ) Dim oBmp As Bitmap oBmp = New Bitmap("d:\bigp ic.jpg") oBmp.Save(Respo nse.OutputStrea m, imageformat.jpe g) Response.End() End Sub End Class
What happens is that the picture does indeed get written but to webform1.aspx. What was in webform1.aspx is completely replaced by
just the image. You might notice that I put Target="_blank" in an attempt to
get it to display a new i.e. page. Thanks, T "Jerry III" <je******@hotma il.com> wrote in message news:uL******** ******@TK2MSFTN GP10.phx.gbl... > What does it come as? You're clearly telling the client that it's an > image/jpeg and you're saving it as such and I'm doing this all the time and > it works just fine. Could you be more specific? Maybe you're saving more > than the image to the response or you're not setting the headers
right... > > Jerry > > "Tina" <ti**********@e xcite.com> wrote in message > news:uz******** ******@TK2MSFTN GP10.phx.gbl... > > Natty, > > That doesn't come through to the client browser as a .jpg and is there > fore > > either impossible or very difficult for them to save the file as a .jpg. > I > > do this all the time from static pages but can't seem to make it work from > > aspx pages and vb.net code. > > Thanks, > > T > > "Natty Gur" <na***@dao2com. com> wrote in message > > news:e1******** *****@TK2MSFTNG P11.phx.gbl... > > > Hi, > > > > > > change the ContentType and write the jpeg. > > > Response.Conten tType = "image/jepg" > > > .. > > > oBmp = New Bitmap(strPath) > > > .. > > > oBmp.Save(Respo nse.OutputStrea m, > > > System.Drawing. Imaging.ImageFo rmat.Jpeg) > > > > > > Natty Gur, CTO > > > Dao2Com Ltd. > > > 34th Elkalay st. Raanana > > > Israel , 43000 > > > Phone Numbers: > > > Office: +972-(0)9-7740261 > > > Fax: +972-(0)9-7740261 > > > Mobile: +972-(0)58-888377 > > > > > > > > > *** Sent via Developersdex http://www.developersdex.com *** > > > Don't just participate in USENET...get rewarded for it! > > > > > >
Maybe this will help. I set the NavigateUrl in code to a aspx file which
streams the picture, but this bit puts it in a new window.
<asp:HyperLin k id="zoom1" name="vlarge"
onclick="vlarge 1=window.open
('','vlarge','r esizable=no,scr ollbars=no,stat us=no,toolbar=n o,height=450,wi d
th=575,left=50, top=100');vlarg e1.focus();retu rn true;"
onmouseover="wi ndow.status='Cl ick here for full sized picture.';retur n
true"
onmouseout="win dow.status=''; return true;"
text="(click here for full size)"
target="vlarge" tooltip = "Click here for full sized picture."
runat="server"/>
"Jerry III" <je******@hotma il.com> wrote in message
news:OK******** *****@TK2MSFTNG P10.phx.gbl... Tina,
this is completely wrong. You're trying to send a jpeg image from
Hires.aspx yet you're sending HTML tags to the response. If you want to do that there should be nothing (and I mean nothing) in the page except page directives and server side script. In your case (using code behind) only the single Page directive should be in your aspx file, like this:
<%@ Page Language="vb" ContentType="im age/jpeg" AutoEventWireup ="false" Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %>
Anything else (such as your HTML in it) will be sent down to the client effectively breaking your jpeg image data. Of course a cleaner way is to send it through a render function instead of in OnLoad event but from the functionally point of view it doesn't matter.
BTW why do you create a file on your disk drive and then send it? Wouldn't it be easier to send it directly without writing it to the drive?
Jerry
"Tina" <ti**********@e xcite.com> wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. there are two pages involved, webform1.aspx and HiRes.aspx. In Webform1.aspx I write a .jpg to the root of d: and do : Server.Transfer ("HiRes.aspx ")
HiRes.aspx is as follows: <%@ Page Language="vb" ContentType="im age/jpeg" AutoEventWireup ="false" Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>test</title> <meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1"> <meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1"> <meta name=vs_default ClientScript content="JavaSc ript"> <meta name=vs_targetS chema content="http://schemas.microso ft.com/intellisense/ie5"> </head> <body MS_POSITIONING= "GridLayout ">
<form id="Form1" target="_blank" method="post" runat="server">
</form>
</body> </html>
and the CodeBehind for hires.aspx is as follows:
Imports System.Drawing. Imaging Public Class HiRes Inherits System.Web.UI.P age
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load Response.Clear( ) Dim oBmp As Bitmap oBmp = New Bitmap("d:\bigp ic.jpg") oBmp.Save(Respo nse.OutputStrea m, imageformat.jpe g) Response.End() End Sub End Class
What happens is that the picture does indeed get written but to webform1.aspx. What was in webform1.aspx is completely replaced by just the image. You might notice that I put Target="_blank" in an attempt to get it to display a new i.e. page. Thanks, T "Jerry III" <je******@hotma il.com> wrote in message news:uL******** ******@TK2MSFTN GP10.phx.gbl... What does it come as? You're clearly telling the client that it's an image/jpeg and you're saving it as such and I'm doing this all the
time and it works just fine. Could you be more specific? Maybe you're saving
more than the image to the response or you're not setting the headers right... Jerry
"Tina" <ti**********@e xcite.com> wrote in message news:uz******** ******@TK2MSFTN GP10.phx.gbl... > Natty, > That doesn't come through to the client browser as a .jpg and is
there fore > either impossible or very difficult for them to save the file as a .jpg. I > do this all the time from static pages but can't seem to make it
work from > aspx pages and vb.net code. > Thanks, > T > "Natty Gur" <na***@dao2com. com> wrote in message > news:e1******** *****@TK2MSFTNG P11.phx.gbl... > > Hi, > > > > change the ContentType and write the jpeg. > > Response.Conten tType = "image/jepg" > > .. > > oBmp = New Bitmap(strPath) > > .. > > oBmp.Save(Respo nse.OutputStrea m, > > System.Drawing. Imaging.ImageFo rmat.Jpeg) > > > > Natty Gur, CTO > > Dao2Com Ltd. > > 34th Elkalay st. Raanana > > Israel , 43000 > > Phone Numbers: > > Office: +972-(0)9-7740261 > > Fax: +972-(0)9-7740261 > > Mobile: +972-(0)58-888377 > > > > > > *** Sent via Developersdex http://www.developersdex.com *** > > Don't just participate in USENET...get rewarded for it! > >
Just use the target attribute. This approach won't work if javascript is
off, target attribute works always. Unless you want to control the windows
appearance but it's just nicer to leave that up to the user.
"vMike" <Mi************ @gewarren.com.n ospam> wrote in message
news:bg******** **@ngspool-d02.news.aol.co m... Maybe this will help. I set the NavigateUrl in code to a aspx file which streams the picture, but this bit puts it in a new window.
<asp:HyperLin k id="zoom1" name="vlarge"
onclick="vlarge 1=window.open
('','vlarge','r esizable=no,scr ollbars=no,stat us=no,toolbar=n o,height=450,wi d th=575,left=50, top=100');vlarg e1.focus();retu rn true;"
onmouseover="wi ndow.status='Cl ick here for full sized picture.';retur n true" onmouseout="win dow.status=''; return true;" text="(click here for full size)" target="vlarge" tooltip = "Click here for full sized picture." runat="server"/> "Jerry III" <je******@hotma il.com> wrote in message news:OK******** *****@TK2MSFTNG P10.phx.gbl... Tina,
this is completely wrong. You're trying to send a jpeg image from Hires.aspx yet you're sending HTML tags to the response. If you want to do that
there should be nothing (and I mean nothing) in the page except page
directives and server side script. In your case (using code behind) only the single Page directive should be in your aspx file, like this:
<%@ Page Language="vb" ContentType="im age/jpeg" AutoEventWireup ="false" Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %>
Anything else (such as your HTML in it) will be sent down to the client effectively breaking your jpeg image data. Of course a cleaner way is to send it through a render function instead of in OnLoad event but from
the functionally point of view it doesn't matter.
BTW why do you create a file on your disk drive and then send it?
Wouldn't it be easier to send it directly without writing it to the drive?
Jerry
"Tina" <ti**********@e xcite.com> wrote in message news:%2******** ********@TK2MSF TNGP10.phx.gbl. .. there are two pages involved, webform1.aspx and HiRes.aspx. In Webform1.aspx I write a .jpg to the root of d: and do : Server.Transfer ("HiRes.aspx ")
HiRes.aspx is as follows: <%@ Page Language="vb" ContentType="im age/jpeg"
AutoEventWireup ="false" Codebehind="HiR es.aspx.vb" Inherits="DBAPh otoQuery.HiRes" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>test</title> <meta name="GENERATOR " content="Micros oft Visual Studio .NET 7.1"> <meta name="CODE_LANG UAGE" content="Visual Basic .NET 7.1"> <meta name=vs_default ClientScript content="JavaSc ript"> <meta name=vs_targetS chema content="http://schemas.microso ft.com/intellisense/ie5"> </head> <body MS_POSITIONING= "GridLayout ">
<form id="Form1" target="_blank" method="post" runat="server">
</form>
</body> </html>
and the CodeBehind for hires.aspx is as follows:
Imports System.Drawing. Imaging Public Class HiRes Inherits System.Web.UI.P age
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load Response.Clear( ) Dim oBmp As Bitmap oBmp = New Bitmap("d:\bigp ic.jpg") oBmp.Save(Respo nse.OutputStrea m, imageformat.jpe g) Response.End() End Sub End Class
What happens is that the picture does indeed get written but to webform1.aspx. What was in webform1.aspx is completely replaced by
just the image. You might notice that I put Target="_blank" in an attempt to
get it to display a new i.e. page. Thanks, T "Jerry III" <je******@hotma il.com> wrote in message news:uL******** ******@TK2MSFTN GP10.phx.gbl... > What does it come as? You're clearly telling the client that it's an > image/jpeg and you're saving it as such and I'm doing this all the time and > it works just fine. Could you be more specific? Maybe you're saving more > than the image to the response or you're not setting the headers
right... > > Jerry > > "Tina" <ti**********@e xcite.com> wrote in message > news:uz******** ******@TK2MSFTN GP10.phx.gbl... > > Natty, > > That doesn't come through to the client browser as a .jpg and is there > fore > > either impossible or very difficult for them to save the file as a .jpg. > I > > do this all the time from static pages but can't seem to make it work from > > aspx pages and vb.net code. > > Thanks, > > T > > "Natty Gur" <na***@dao2com. com> wrote in message > > news:e1******** *****@TK2MSFTNG P11.phx.gbl... > > > Hi, > > > > > > change the ContentType and write the jpeg. > > > Response.Conten tType = "image/jepg" > > > .. > > > oBmp = New Bitmap(strPath) > > > .. > > > oBmp.Save(Respo nse.OutputStrea m, > > > System.Drawing. Imaging.ImageFo rmat.Jpeg) > > > > > > Natty Gur, CTO > > > Dao2Com Ltd. > > > 34th Elkalay st. Raanana > > > Israel , 43000 > > > Phone Numbers: > > > Office: +972-(0)9-7740261 > > > Fax: +972-(0)9-7740261 > > > Mobile: +972-(0)58-888377 > > > > > > > > > *** Sent via Developersdex http://www.developersdex.com *** > > > Don't just participate in USENET...get rewarded for it! > > > > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nicolas Poirier |
last post by:
Is there a simple way to display a small bitmap in a way that it fills the
whole background of a form? I mean a mosaic of small bitmaps like the ones
used to cover my desktop's background.
Thank You
Nicolas Poirier
|
by: serge calderara |
last post by:
Dear all,
Is there a way to display bitmaps inside a datagrid ?
regards
serge
|
by: Paul Nuschke |
last post by:
Anyone know how to display a bitmap from an array using ATL, MFC, et
al.
Thanks,
Paul Nuschke
|
by: serge calderara |
last post by:
Dear all
I have a datagrid which is bind to a dataset
On column in the dataset represent a STATUS
Instead of diplaying in my datagrid value of 1 and 0 corresponding to that
STATUS field, I would like to display a Green bitmap for a value of 1 and a
Red bitmap for a value of 0
how can I do that ??
|
by: serge calderara |
last post by:
Dear all,
how to display bitmap inside column template ?
I have use following syntax :
<asp:ButtonColumn Text='<%# <img src= "search.gif" >%>/></asp:ButtonColumn
but when running it says, binding not correct
any idea ?
| |
by: srinpraveen |
last post by:
I want to put a bitmap image which I have created using Microsoft paint onto my C++ program. I am working in Turbo C++ environment. How do I implement it? I found that putimage() attribute does not satisfy my need. I am relatively new to C++ programming and in the process of learning in my college. So please bear it if my question appears silly. By the way I am interested in game programming.
|
by: saranjegan |
last post by:
can we display bitmap image using C programming..which compiler suits best..
let me know the steps fallowed for displaying the bmp image
thanks for your time
|
by: mallyajiggs |
last post by:
form_load () { Call bitmap_func() }
bitmap_func()
{
Image mybitmap = new Bitmap("c:\\abc.bmp");
Graphics g1 = Graphics.FromImage(mybitmap);
g1.DrawImageUnscaled(mybitmap, 400, 400);
this.CreateGraphics().DrawImage(mybitmap, new Point(0, 0));
}
|
by: davidpryce123 |
last post by:
Dear Group.
For an application I am developing I need to display a 64 bit bitmap
as a compressed ascii string of bits. This is to allow for the
easier understanding of the bits for the users.
For example in the bitmap if bits, 1,2,3,4,5,6, 17,18,19 and 63 are
set they would like to display a string 1-6,17-19, 63.
Is there a easy way to do this in Csharp or do I need to roll my own?
|
by: bruffchewren |
last post by:
Hi there dear gurus and expert coders.
i am not gonna start with im a newbie and don't know much about image programming but unfortunately those are the facts :(
I am trying to display an image from a bitmap pointer *ImageData which is of resolution 1392x1032. I am trying to draw that at an area of resolution or size 627x474.
However, repeated trying doesnt seem to work. It works when I change the bitmap image I created from *ImageData...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |