473,394 Members | 1,755 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,394 software developers and data experts.

HTML / ASPX image

tma
I have the following HTML in use on my web page. I need it to show a graphic
image on the page but do not know what to use in the codebehind to make the
graphic appear. If I load the source url in a browser by itself, the graphic
appears, but when I use the tag in a web page it does not. Anyone have a
suggestion for VB?

<img
src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413'
border=0 alt>

Nov 18 '05 #1
11 2838
I'm under the impression that the src element of the <img tab needs to point
to either a .gif file or a .jpg file, not to the httpresponse of a aspx
page.

"tma" <tm*@allisconfusing.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I have the following HTML in use on my web page. I need it to show a graphic image on the page but do not know what to use in the codebehind to make the graphic appear. If I load the source url in a browser by itself, the graphic appears, but when I use the tag in a web page it does not. Anyone have a
suggestion for VB?

<img
src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413' border=0 alt>

Nov 18 '05 #2
Hi,

The img control loads a graphic, you are loading an ASPX page. To do what
you are doing create a user control and then use that in your page.

Creating a user control:
http://msdn.microsoft.com/library/de...ercontrols.asp

Adding a user control:
http://msdn.microsoft.com/library/de...bformspage.asp

Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"tma" <tm*@allisconfusing.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I have the following HTML in use on my web page. I need it to show a graphic image on the page but do not know what to use in the codebehind to make the graphic appear. If I load the source url in a browser by itself, the graphic appears, but when I use the tag in a web page it does not. Anyone have a
suggestion for VB?

<img
src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413' border=0 alt>

Nov 18 '05 #3
> I'm under the impression that the src element of the <img tab needs to
point
to either a .gif file or a .jpg file, not to the httpresponse of a aspx
page.
Well, you're under the wrong impression. An ASPX page can indeed serve an
image, and can indeed be used in an image tag.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"i. Wiin" <ii****@yagoo.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl... I'm under the impression that the src element of the <img tab needs to point to either a .gif file or a .jpg file, not to the httpresponse of a aspx
page.

"tma" <tm*@allisconfusing.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I have the following HTML in use on my web page. I need it to show a

graphic
image on the page but do not know what to use in the codebehind to make

the
graphic appear. If I load the source url in a browser by itself, the

graphic
appears, but when I use the tag in a web page it does not. Anyone have a
suggestion for VB?

<img

src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413'
border=0 alt>


Nov 18 '05 #4
I check out the URL you posted: no image. Did you swap out the real URL for
a fake one? It's kind of hard to help in that case. Can you post the real
URL? The first thing I want to make sure of is that the page is really
returning an image. It may be returning HTML that contains an image tag,
wich would be wrong. Can't tell without the URL.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"tma" <tm*@allisconfusing.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I have the following HTML in use on my web page. I need it to show a graphic image on the page but do not know what to use in the codebehind to make the graphic appear. If I load the source url in a browser by itself, the graphic appears, but when I use the tag in a web page it does not. Anyone have a
suggestion for VB?

<img
src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413' border=0 alt>

Nov 18 '05 #5
tma wrote:
I have the following HTML in use on my web page. I need it to show a
graphic image on the page but do not know what to use in the
codebehind to make the graphic appear. If I load the source url in a
browser by itself, the graphic appears, but when I use the tag in a
web page it does not. Anyone have a suggestion for VB?

<img
src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413'
border=0 alt>


This method should work. It's not required to use the "correct" extension
as others suggested, as long as you set the correct contenttype
(image/gif, image/jpeg, ..). See Response.ContentType.

Did something go wrong with the post? I noticed that you seemed to have
no space before "border" and no value for "alt".

Hans Kesting
Nov 18 '05 #6
Hi Kevin,

This is good to know. How do you return an image or maybe other type of
file from an ASPX page? The reason I'm asking is that Forms Authentication
seems to only protect ASPX pages and using this it could be used to force
people to log in who are trying to go directly to something other than an
ASPX page. Thanks! Ken.

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:O2**************@TK2MSFTNGP11.phx.gbl...
I'm under the impression that the src element of the <img tab needs to

point
to either a .gif file or a .jpg file, not to the httpresponse of a aspx
page.


Well, you're under the wrong impression. An ASPX page can indeed serve an
image, and can indeed be used in an image tag.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"i. Wiin" <ii****@yagoo.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
I'm under the impression that the src element of the <img tab needs to

point
to either a .gif file or a .jpg file, not to the httpresponse of a aspx
page.

"tma" <tm*@allisconfusing.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I have the following HTML in use on my web page. I need it to show a

graphic
image on the page but do not know what to use in the codebehind to make
the
graphic appear. If I load the source url in a browser by itself, the

graphic
appears, but when I use the tag in a web page it does not. Anyone have
a suggestion for VB?

<img

src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413'
border=0 alt>



Nov 18 '05 #7
Hi Ken,
This is good to know. How do you return an image or maybe other type of
file from an ASPX page?
An ASPX Page class is an HttpHandler. It handles HTTP requests. It can
therefore handle a request for an image. The page gets the image in one of a
large variety of ways (builds it, fetches it, etc), sets the
Response.ContentType to "image/jpg" (or whatever MIME type you are working
with), and then saves the image to the Response.OutputStream. You can then
reference the page in an image tag. Example:

<img src="image.aspx?modificationParameter=value">

Note that, since it is an ASPX page, you can pass additional data to it via
the QueryString, for modifying the image, or whatever you need.
The reason I'm asking is that Forms Authentication
seems to only protect ASPX pages and using this it could be used to force
people to log in who are trying to go directly to something other than an
ASPX page.
Having a hard time figuring this one out, but if I understand you correctly,
yes, it could.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Ken Dopierala Jr." <kd*********@wi.rr.com> wrote in message
news:eK**************@tk2msftngp13.phx.gbl... Hi Kevin,

This is good to know. How do you return an image or maybe other type of
file from an ASPX page? The reason I'm asking is that Forms Authentication seems to only protect ASPX pages and using this it could be used to force
people to log in who are trying to go directly to something other than an
ASPX page. Thanks! Ken.

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:O2**************@TK2MSFTNGP11.phx.gbl...
I'm under the impression that the src element of the <img tab needs to point
to either a .gif file or a .jpg file, not to the httpresponse of a aspx page.


Well, you're under the wrong impression. An ASPX page can indeed serve an
image, and can indeed be used in an image tag.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"i. Wiin" <ii****@yagoo.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
I'm under the impression that the src element of the <img tab needs to

point
to either a .gif file or a .jpg file, not to the httpresponse of a aspx page.

"tma" <tm*@allisconfusing.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
> I have the following HTML in use on my web page. I need it to show a
graphic
> image on the page but do not know what to use in the codebehind to

make the
> graphic appear. If I load the source url in a browser by itself, the
graphic
> appears, but when I use the tag in a web page it does not. Anyone have a
> suggestion for VB?
>
> <img
>

src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413' > border=0 alt>
>
>
>



Nov 18 '05 #8
Ken Dopierala Jr. wrote:
Hi Kevin,

This is good to know. How do you return an image or maybe other type
of file from an ASPX page?


Technically, what you need to do is set the appropriate Content-Type header,
ideally Content-Length as well, and write your binary content to the
response's output stream.

In real world applications, I'd rather use a dedicated HttpHandler for
delivering images and such, because you hardly want all the Page processing
overhead for these specialized "content providers".

Cheers,

--
Joerg Jooss
jo*********@gmx.net
Nov 18 '05 #9
Hi Kevin,

I did a search to see if people are already using this and they are...so
much for a novel idea, hey? Here is a link, it explains it better than I
did and now I don't have to re-invent the wheel. Thanks again! Ken.

http://www.codeproject.com/aspnet/imagehandler.asp

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:OG*************@TK2MSFTNGP11.phx.gbl...
Hi Ken,
This is good to know. How do you return an image or maybe other type of
file from an ASPX page?
An ASPX Page class is an HttpHandler. It handles HTTP requests. It can
therefore handle a request for an image. The page gets the image in one of

a large variety of ways (builds it, fetches it, etc), sets the
Response.ContentType to "image/jpg" (or whatever MIME type you are working
with), and then saves the image to the Response.OutputStream. You can then
reference the page in an image tag. Example:

<img src="image.aspx?modificationParameter=value">

Note that, since it is an ASPX page, you can pass additional data to it via the QueryString, for modifying the image, or whatever you need.
The reason I'm asking is that Forms Authentication
seems to only protect ASPX pages and using this it could be used to force
people to log in who are trying to go directly to something other than an ASPX page.
Having a hard time figuring this one out, but if I understand you

correctly, yes, it could.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Ken Dopierala Jr." <kd*********@wi.rr.com> wrote in message
news:eK**************@tk2msftngp13.phx.gbl...
Hi Kevin,

This is good to know. How do you return an image or maybe other type of
file from an ASPX page? The reason I'm asking is that Forms

Authentication
seems to only protect ASPX pages and using this it could be used to force people to log in who are trying to go directly to something other than an ASPX page. Thanks! Ken.

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:O2**************@TK2MSFTNGP11.phx.gbl...
> I'm under the impression that the src element of the <img tab needs to point
> to either a .gif file or a .jpg file, not to the httpresponse of a

aspx > page.

Well, you're under the wrong impression. An ASPX page can indeed serve an image, and can indeed be used in an image tag.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"i. Wiin" <ii****@yagoo.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
> I'm under the impression that the src element of the <img tab needs to point
> to either a .gif file or a .jpg file, not to the httpresponse of a aspx > page.
>
>
>
> "tma" <tm*@allisconfusing.net> wrote in message
> news:eT**************@TK2MSFTNGP12.phx.gbl...
> > I have the following HTML in use on my web page. I need it to show a > graphic
> > image on the page but do not know what to use in the codebehind to

make
> the
> > graphic appear. If I load the source url in a browser by itself, the > graphic
> > appears, but when I use the tag in a web page it does not. Anyone have
a
> > suggestion for VB?
> >
> > <img
> >
>

src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413'
> > border=0 alt>
> >
> >
> >
>
>



Nov 18 '05 #10
tma
This is a working URL which, as you will see, shows an image. It does not
work embedded as <img> in a page.

http://www.mymohawk.com/MohawkWS/Moh...px?ItemID=1234

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I check out the URL you posted: no image. Did you swap out the real URL for a fake one? It's kind of hard to help in that case. Can you post the real
URL? The first thing I want to make sure of is that the page is really
returning an image. It may be returning HTML that contains an image tag,
wich would be wrong. Can't tell without the URL.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"tma" <tm*@allisconfusing.net> wrote in message
news:eT**************@TK2MSFTNGP12.phx.gbl...
I have the following HTML in use on my web page. I need it to show a

graphic
image on the page but do not know what to use in the codebehind to make

the
graphic appear. If I load the source url in a browser by itself, the

graphic
appears, but when I use the tag in a web page it does not. Anyone have a
suggestion for VB?

<img

src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413'
border=0 alt>


Nov 18 '05 #11
tma
Kevin, what does the code behind look like that sets the response type and
saves the image to the output stream?

Please!

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:OG*************@TK2MSFTNGP11.phx.gbl...
Hi Ken,
This is good to know. How do you return an image or maybe other type of
file from an ASPX page?
An ASPX Page class is an HttpHandler. It handles HTTP requests. It can
therefore handle a request for an image. The page gets the image in one of

a large variety of ways (builds it, fetches it, etc), sets the
Response.ContentType to "image/jpg" (or whatever MIME type you are working
with), and then saves the image to the Response.OutputStream. You can then
reference the page in an image tag. Example:

<img src="image.aspx?modificationParameter=value">

Note that, since it is an ASPX page, you can pass additional data to it via the QueryString, for modifying the image, or whatever you need.
The reason I'm asking is that Forms Authentication
seems to only protect ASPX pages and using this it could be used to force
people to log in who are trying to go directly to something other than an ASPX page.
Having a hard time figuring this one out, but if I understand you

correctly, yes, it could.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Ken Dopierala Jr." <kd*********@wi.rr.com> wrote in message
news:eK**************@tk2msftngp13.phx.gbl...
Hi Kevin,

This is good to know. How do you return an image or maybe other type of
file from an ASPX page? The reason I'm asking is that Forms

Authentication
seems to only protect ASPX pages and using this it could be used to force people to log in who are trying to go directly to something other than an ASPX page. Thanks! Ken.

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:O2**************@TK2MSFTNGP11.phx.gbl...
> I'm under the impression that the src element of the <img tab needs to point
> to either a .gif file or a .jpg file, not to the httpresponse of a

aspx > page.

Well, you're under the wrong impression. An ASPX page can indeed serve an image, and can indeed be used in an image tag.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"i. Wiin" <ii****@yagoo.com> wrote in message
news:eZ**************@TK2MSFTNGP14.phx.gbl...
> I'm under the impression that the src element of the <img tab needs to point
> to either a .gif file or a .jpg file, not to the httpresponse of a aspx > page.
>
>
>
> "tma" <tm*@allisconfusing.net> wrote in message
> news:eT**************@TK2MSFTNGP12.phx.gbl...
> > I have the following HTML in use on my web page. I need it to show a > graphic
> > image on the page but do not know what to use in the codebehind to

make
> the
> > graphic appear. If I load the source url in a browser by itself, the > graphic
> > appears, but when I use the tag in a web page it does not. Anyone have
a
> > suggestion for VB?
> >
> > <img
> >
>

src='http://www.domain.com/MohawkWS/MohawkHitCounter.aspx?ItemID=7103830413'
> > border=0 alt>
> >
> >
> >
>
>



Nov 18 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Lukasz Indyk | last post by:
i want to convert html to image (format of the image does not matter). is it possible in python? or mayby it is possible to convert html first to the postscript, and then postscript to image?
0
by: shay | last post by:
if anyone have a good idea about how to creat an html to image component i tried : A. capture a web browser controll prob 1. a win form app , we need to put the web controll inside A dll file....
2
by: EMW | last post by:
Hi, I use the following to start my ASPX: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>index</title> <meta name="vs_defaultClientScript"...
0
by: Zhao Sheng | last post by:
http://www.guangmingsoft.com/htmltoimage/help.htm Html To Image Html To Image 2.0 Released! Html To Image help you convert html page from any URL to image or thumbnails easily and quickly. ...
6
by: PenguinPig | last post by:
Dear All Experts I would like to know how to convert a HTML into Image using C#. Or allow me contains HTML code (parsed) in Image? I also tried this way but it just display the character "<" &...
4
by: Neil.Smith | last post by:
I can't seem to find any references to this, but here goes: In there anyway to parse an html/aspx file within an asp.net application to gather a collection of controls in the file. For instance...
2
by: pop | last post by:
Microsoft says that ------------ ASP.NET version 2.0 on Windows Server 2003 protects all files in a given directory, even those not mapped to ASP.NET, such as .html, .gif, and .jpg files....
2
by: ksrashmi | last post by:
is it possible to covert html to image . with java code ? like using 2dGraphics or some other thing ?
18
by: amritpalpathak | last post by:
I have made the html+javascript code.According to which when the page loaded the image size gets reduced to 50,50 and onclicking on it ,size increases to 500,500,but i done it with the one copy of ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
tracyyun
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...

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.