473,500 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedding another page into my page

J-T
Hi All,

There is a picture on the following URL which I want to have it in one of
my asp.net pages .I mean I want to embed the content of this page in my own
page and get its image.Is there a control or tecnique which I can
accomplish this?

http://www.tehrantraffic.com/gif.asp...TTCC%20website

Thanks a lot
Nov 19 '05 #1
18 2126
I'd try an <iframe> element.

HTH,
Axel Dahmen

------------------
"J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
news:eH**************@tk2msftngp13.phx.gbl...
Hi All,

There is a picture on the following URL which I want to have it in one of
my asp.net pages .I mean I want to embed the content of this page in my own page and get its image.Is there a control or tecnique which I can
accomplish this?

http://www.tehrantraffic.com/gif.asp...TTCC%20website
Thanks a lot

Nov 19 '05 #2
Yep! <iframe> will do.

<iframe
src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
"Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
I'd try an <iframe> element.

HTH,
Axel Dahmen

------------------
"J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
news:eH**************@tk2msftngp13.phx.gbl...
Hi All,

There is a picture on the following URL which I want to have it in one of
my asp.net pages .I mean I want to embed the content of this page in my

own
page and get its image.Is there a control or tecnique which I can
accomplish this?

http://www.tehrantraffic.com/gif.asp...TTCC%20website

Thanks a lot


Nov 19 '05 #3
Another possibility would be to use a web request and a literal control.
This is the method I prefer because you can check if the request is valid
and handle the possibility of the page you're requesting not showing up...

Something along these lines:

'---Create the request

Dim WebRequest As System.Net.WebRequest = System.Net.WebRequest.Create(New
Uri(CurrentLink))

WebRequest.Timeout = 2000

'---Get the response produced by the request

Dim Response As System.Net.WebResponse = WebRequest.GetResponse

'---Download the page content into a stream

Dim Stream As System.IO.Stream = Response.GetResponseStream

'---Place the stream into a stream reader

Dim StreamReader As New System.IO.StreamReader(Stream)

'---Read the stream into a string object

Dim HtmlReceived As String = StreamReader.ReadToEnd

'---Place the string into a literal control

Literal1.Text = HtmlReceived

'---Cleanup

Stream.Close()

StreamReader.Close()
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Onin Tayson" <Le*********@compaid.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yep! <iframe> will do.

<iframe
src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
"Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
I'd try an <iframe> element.

HTH,
Axel Dahmen

------------------
"J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
news:eH**************@tk2msftngp13.phx.gbl...
Hi All,

There is a picture on the following URL which I want to have it in one
of
my asp.net pages .I mean I want to embed the content of this page in my

own
page and get its image.Is there a control or tecnique which I can
accomplish this?

http://www.tehrantraffic.com/gif.asp...TTCC%20website

Thanks a lot



Nov 19 '05 #4
J-T
Thanks for the reply.

I used the way that you suggested ,but the problem is that it is returing
relative path to the picture which is in the page and because that picture
dosen;t exist in my website ,the picture is not showig up well.Page contains
a relative path to the picture and page is not part of my website,I am
getting its content from a website to which I have to access.When I use
iframe the whole page is rendered and then I don;t care about the paths in
the page.

Any suggesions?

Thanks agian
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:uF**************@TK2MSFTNGP14.phx.gbl...
Another possibility would be to use a web request and a literal control.
This is the method I prefer because you can check if the request is valid
and handle the possibility of the page you're requesting not showing up...

Something along these lines:

'---Create the request

Dim WebRequest As System.Net.WebRequest = System.Net.WebRequest.Create(New
Uri(CurrentLink))

WebRequest.Timeout = 2000

'---Get the response produced by the request

Dim Response As System.Net.WebResponse = WebRequest.GetResponse

'---Download the page content into a stream

Dim Stream As System.IO.Stream = Response.GetResponseStream

'---Place the stream into a stream reader

Dim StreamReader As New System.IO.StreamReader(Stream)

'---Read the stream into a string object

Dim HtmlReceived As String = StreamReader.ReadToEnd

'---Place the string into a literal control

Literal1.Text = HtmlReceived

'---Cleanup

Stream.Close()

StreamReader.Close()
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Onin Tayson" <Le*********@compaid.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yep! <iframe> will do.

<iframe
src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
"Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
I'd try an <iframe> element.

HTH,
Axel Dahmen

------------------
"J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
news:eH**************@tk2msftngp13.phx.gbl...
Hi All,

There is a picture on the following URL which I want to have it in one
of
my asp.net pages .I mean I want to embed the content of this page in my
own
page and get its image.Is there a control or tecnique which I can
accomplish this?
http://www.tehrantraffic.com/gif.asp...TTCC%20website

Thanks a lot



Nov 19 '05 #5
J-T
Thanks guys ,it works very well.My only problem is that I have to refresh
the content of the iframe every 2 minues ,I am palcing this iframe in a user
control which is loaded by an aspx page .I used java script code in the user
control to refresh it every 2 minutes ,but it seems that refreshing the user
control dosen;t refresh the content of the iframe.

Any ideas?

Thanks

"Onin Tayson" <Le*********@compaid.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yep! <iframe> will do.

<iframe
src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
"Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
I'd try an <iframe> element.

HTH,
Axel Dahmen

------------------
"J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
news:eH**************@tk2msftngp13.phx.gbl...
Hi All,

There is a picture on the following URL which I want to have it in one
of
my asp.net pages .I mean I want to embed the content of this page in my

own
page and get its image.Is there a control or tecnique which I can
accomplish this?

http://www.tehrantraffic.com/gif.asp...TTCC%20website

Thanks a lot



Nov 19 '05 #6
J-T,

Is it always the same picture you're after? Or will the url change?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
Thanks for the reply.

I used the way that you suggested ,but the problem is that it is returing
relative path to the picture which is in the page and because that
picture dosen;t exist in my website ,the picture is not showig up
well.Page contains a relative path to the picture and page is not part of
my website,I am getting its content from a website to which I have to
access.When I use iframe the whole page is rendered and then I don;t care
about the paths in the page.

Any suggesions?

Thanks agian
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:uF**************@TK2MSFTNGP14.phx.gbl...
Another possibility would be to use a web request and a literal control.
This is the method I prefer because you can check if the request is valid
and handle the possibility of the page you're requesting not showing
up...

Something along these lines:

'---Create the request

Dim WebRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(New
Uri(CurrentLink))

WebRequest.Timeout = 2000

'---Get the response produced by the request

Dim Response As System.Net.WebResponse = WebRequest.GetResponse

'---Download the page content into a stream

Dim Stream As System.IO.Stream = Response.GetResponseStream

'---Place the stream into a stream reader

Dim StreamReader As New System.IO.StreamReader(Stream)

'---Read the stream into a string object

Dim HtmlReceived As String = StreamReader.ReadToEnd

'---Place the string into a literal control

Literal1.Text = HtmlReceived

'---Cleanup

Stream.Close()

StreamReader.Close()
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Onin Tayson" <Le*********@compaid.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yep! <iframe> will do.

<iframe
src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
"Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
I'd try an <iframe> element.

HTH,
Axel Dahmen

------------------
"J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
news:eH**************@tk2msftngp13.phx.gbl...
> Hi All,
>
> There is a picture on the following URL which I want to have it in one
> of
> my asp.net pages .I mean I want to embed the content of this page in
> my
own
> page and get its image.Is there a control or tecnique which I can
> accomplish this?
>
>
http://www.tehrantraffic.com/gif.asp...TTCC%20website
>
> Thanks a lot
>
>



Nov 19 '05 #7
J-T

Always same picture.URL never gets changed!!!

Thanks

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eD*************@TK2MSFTNGP11.phx.gbl...
J-T,

Is it always the same picture you're after? Or will the url change?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
Thanks for the reply.

I used the way that you suggested ,but the problem is that it is returing
relative path to the picture which is in the page and because that
picture dosen;t exist in my website ,the picture is not showig up
well.Page contains a relative path to the picture and page is not part of
my website,I am getting its content from a website to which I have to
access.When I use iframe the whole page is rendered and then I don;t care
about the paths in the page.

Any suggesions?

Thanks agian
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:uF**************@TK2MSFTNGP14.phx.gbl...
Another possibility would be to use a web request and a literal control.
This is the method I prefer because you can check if the request is
valid and handle the possibility of the page you're requesting not
showing up...

Something along these lines:

'---Create the request

Dim WebRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(New
Uri(CurrentLink))

WebRequest.Timeout = 2000

'---Get the response produced by the request

Dim Response As System.Net.WebResponse = WebRequest.GetResponse

'---Download the page content into a stream

Dim Stream As System.IO.Stream = Response.GetResponseStream

'---Place the stream into a stream reader

Dim StreamReader As New System.IO.StreamReader(Stream)

'---Read the stream into a string object

Dim HtmlReceived As String = StreamReader.ReadToEnd

'---Place the string into a literal control

Literal1.Text = HtmlReceived

'---Cleanup

Stream.Close()

StreamReader.Close()
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Onin Tayson" <Le*********@compaid.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Yep! <iframe> will do.

<iframe
src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
"Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
news:Ot**************@TK2MSFTNGP12.phx.gbl...
> I'd try an <iframe> element.
>
> HTH,
> Axel Dahmen
>
>
>
> ------------------
> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
> news:eH**************@tk2msftngp13.phx.gbl...
>> Hi All,
>>
>> There is a picture on the following URL which I want to have it in
>> one of
>> my asp.net pages .I mean I want to embed the content of this page in
>> my
> own
>> page and get its image.Is there a control or tecnique which I can
>> accomplish this?
>>
>>
> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>
>> Thanks a lot
>>
>>
>
>



Nov 19 '05 #8
In that case you could create a .aspx page that sends the image to you using
the response object.

You would then set the link of your image to the imagedelivery.aspx page.

The code for the delivery page would be like this:

'------------------------------------------------------------------------------------------
'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo DateModified:
By:
'
' Comments:
' Delivers an image from the image table stored in memory as a stream.
'------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MemoryStream As System.IO.Stream
Try
Response.Clear()
Response.ContentType = "image/jpeg"

Dim ImageWebRequest As System.Net.WebRequest

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.mywebapp/uri of image here.jpg"))
ImageWebRequest.Timeout = 2000

'---Get the response produced by the request
Dim Response As System.Net.WebResponse =
ImageWebRequest.GetResponse

'---Download the page content into a stream
MemoryStream = Response.GetResponseStream

Response.BinaryWrite(MemoryStream.GetBuffer)
Catch ex As Exception
'---Handle any errors here.
Finally
If Not MemoryStream Is Nothing Then
MemoryStream.Close()
MemoryStream = Nothing
End If
End Try
End Sub
Then set your link to the image delivery page. You could even tack on a
random number as a querystring id to the default page's url each page load
something like:

Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
Rnd.ToString & Rnd.ToString

The query string will make the client browser think that the image url has
changed every page load. Thus, no caching of images.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:eD*************@tk2msftngp13.phx.gbl...

Always same picture.URL never gets changed!!!

Thanks

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eD*************@TK2MSFTNGP11.phx.gbl...
J-T,

Is it always the same picture you're after? Or will the url change?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
Thanks for the reply.

I used the way that you suggested ,but the problem is that it is
returing relative path to the picture which is in the page and because
that picture dosen;t exist in my website ,the picture is not showig up
well.Page contains a relative path to the picture and page is not part
of my website,I am getting its content from a website to which I have to
access.When I use iframe the whole page is rendered and then I don;t
care about the paths in the page.

Any suggesions?

Thanks agian
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:uF**************@TK2MSFTNGP14.phx.gbl...
Another possibility would be to use a web request and a literal
control. This is the method I prefer because you can check if the
request is valid and handle the possibility of the page you're
requesting not showing up...

Something along these lines:

'---Create the request

Dim WebRequest As System.Net.WebRequest =
System.Net.WebRequest.Create(New
Uri(CurrentLink))

WebRequest.Timeout = 2000

'---Get the response produced by the request

Dim Response As System.Net.WebResponse = WebRequest.GetResponse

'---Download the page content into a stream

Dim Stream As System.IO.Stream = Response.GetResponseStream

'---Place the stream into a stream reader

Dim StreamReader As New System.IO.StreamReader(Stream)

'---Read the stream into a string object

Dim HtmlReceived As String = StreamReader.ReadToEnd

'---Place the string into a literal control

Literal1.Text = HtmlReceived

'---Cleanup

Stream.Close()

StreamReader.Close()
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Onin Tayson" <Le*********@compaid.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
> Yep! <iframe> will do.
>
> <iframe
> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>
>
> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>> I'd try an <iframe> element.
>>
>> HTH,
>> Axel Dahmen
>>
>>
>>
>> ------------------
>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>> news:eH**************@tk2msftngp13.phx.gbl...
>>> Hi All,
>>>
>>> There is a picture on the following URL which I want to have it in
>>> one of
>>> my asp.net pages .I mean I want to embed the content of this page in
>>> my
>> own
>>> page and get its image.Is there a control or tecnique which I can
>>> accomplish this?
>>>
>>>
>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>
>>> Thanks a lot
>>>
>>>
>>
>>
>
>



Nov 19 '05 #9
J-T
Sorry,I guessed I am misleading you by bad explanation.

The source is a page that contains the image :

http://www.tehrantraffic.com/gif.asp...TTCC%20website

page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg !The
picture is being updated every 2 minues and that's why I need to update my
hosting user control in 2 minutes as well to show latest picture.I have no
access to the image so any relative path to the image dosen;t work,the only
thing I have access to is the URL I mentioned above.

Thanks a lot for the help

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eU**************@TK2MSFTNGP12.phx.gbl...
In that case you could create a .aspx page that sends the image to you
using the response object.

You would then set the link of your image to the imagedelivery.aspx page.

The code for the delivery page would be like this:

'------------------------------------------------------------------------------------------
'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo DateModified:
By:
'
' Comments:
' Delivers an image from the image table stored in memory as a
stream.
'------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MemoryStream As System.IO.Stream
Try
Response.Clear()
Response.ContentType = "image/jpeg"

Dim ImageWebRequest As System.Net.WebRequest

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.mywebapp/uri of image here.jpg"))
ImageWebRequest.Timeout = 2000

'---Get the response produced by the request
Dim Response As System.Net.WebResponse =
ImageWebRequest.GetResponse

'---Download the page content into a stream
MemoryStream = Response.GetResponseStream

Response.BinaryWrite(MemoryStream.GetBuffer)
Catch ex As Exception
'---Handle any errors here.
Finally
If Not MemoryStream Is Nothing Then
MemoryStream.Close()
MemoryStream = Nothing
End If
End Try
End Sub
Then set your link to the image delivery page. You could even tack on a
random number as a querystring id to the default page's url each page load
something like:

Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
Rnd.ToString & Rnd.ToString

The query string will make the client browser think that the image url has
changed every page load. Thus, no caching of images.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:eD*************@tk2msftngp13.phx.gbl...

Always same picture.URL never gets changed!!!

Thanks

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eD*************@TK2MSFTNGP11.phx.gbl...
J-T,

Is it always the same picture you're after? Or will the url change?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
Thanks for the reply.

I used the way that you suggested ,but the problem is that it is
returing relative path to the picture which is in the page and because
that picture dosen;t exist in my website ,the picture is not showig up
well.Page contains a relative path to the picture and page is not part
of my website,I am getting its content from a website to which I have
to access.When I use iframe the whole page is rendered and then I don;t
care about the paths in the page.

Any suggesions?

Thanks agian
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:uF**************@TK2MSFTNGP14.phx.gbl...
> Another possibility would be to use a web request and a literal
> control. This is the method I prefer because you can check if the
> request is valid and handle the possibility of the page you're
> requesting not showing up...
>
> Something along these lines:
>
> '---Create the request
>
> Dim WebRequest As System.Net.WebRequest =
> System.Net.WebRequest.Create(New
> Uri(CurrentLink))
>
> WebRequest.Timeout = 2000
>
> '---Get the response produced by the request
>
> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>
> '---Download the page content into a stream
>
> Dim Stream As System.IO.Stream = Response.GetResponseStream
>
> '---Place the stream into a stream reader
>
> Dim StreamReader As New System.IO.StreamReader(Stream)
>
> '---Read the stream into a string object
>
> Dim HtmlReceived As String = StreamReader.ReadToEnd
>
> '---Place the string into a literal control
>
> Literal1.Text = HtmlReceived
>
> '---Cleanup
>
> Stream.Close()
>
> StreamReader.Close()
>
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "Onin Tayson" <Le*********@compaid.com> wrote in message
> news:%2****************@TK2MSFTNGP10.phx.gbl...
>> Yep! <iframe> will do.
>>
>> <iframe
>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>
>>
>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>> I'd try an <iframe> element.
>>>
>>> HTH,
>>> Axel Dahmen
>>>
>>>
>>>
>>> ------------------
>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>> Hi All,
>>>>
>>>> There is a picture on the following URL which I want to have it in
>>>> one of
>>>> my asp.net pages .I mean I want to embed the content of this page
>>>> in my
>>> own
>>>> page and get its image.Is there a control or tecnique which I can
>>>> accomplish this?
>>>>
>>>>
>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>
>>>> Thanks a lot
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #10
J-T,

In the code I sent you put the image url itself into the code:

ImageWebRequest = System.Net.WebRequest.Create(New
Uri(http://www.tehrantraffic.com/cam3_ttcc_00001.jpg))

That's why I was asking if the image name changed. As long as the image name
will always be "_ttcc_00001.jpg then the code I gave you will work. Plus you
can handle an error if for some reason a request for the image doesn't go
through and you can make certain it will never be cached on the client...
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:u9***************@tk2msftngp13.phx.gbl...
Sorry,I guessed I am misleading you by bad explanation.

The source is a page that contains the image :

http://www.tehrantraffic.com/gif.asp...TTCC%20website

page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg !The
picture is being updated every 2 minues and that's why I need to update my
hosting user control in 2 minutes as well to show latest picture.I have no
access to the image so any relative path to the image dosen;t work,the
only thing I have access to is the URL I mentioned above.

Thanks a lot for the help

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eU**************@TK2MSFTNGP12.phx.gbl...
In that case you could create a .aspx page that sends the image to you
using the response object.

You would then set the link of your image to the imagedelivery.aspx page.

The code for the delivery page would be like this:

'------------------------------------------------------------------------------------------
'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo DateModified:
By:
'
' Comments:
' Delivers an image from the image table stored in memory as a
stream.
'------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MemoryStream As System.IO.Stream
Try
Response.Clear()
Response.ContentType = "image/jpeg"

Dim ImageWebRequest As System.Net.WebRequest

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.mywebapp/uri of image here.jpg"))
ImageWebRequest.Timeout = 2000

'---Get the response produced by the request
Dim Response As System.Net.WebResponse =
ImageWebRequest.GetResponse

'---Download the page content into a stream
MemoryStream = Response.GetResponseStream

Response.BinaryWrite(MemoryStream.GetBuffer)
Catch ex As Exception
'---Handle any errors here.
Finally
If Not MemoryStream Is Nothing Then
MemoryStream.Close()
MemoryStream = Nothing
End If
End Try
End Sub
Then set your link to the image delivery page. You could even tack on a
random number as a querystring id to the default page's url each page
load something like:

Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
Rnd.ToString & Rnd.ToString

The query string will make the client browser think that the image url
has changed every page load. Thus, no caching of images.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:eD*************@tk2msftngp13.phx.gbl...

Always same picture.URL never gets changed!!!

Thanks

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eD*************@TK2MSFTNGP11.phx.gbl...
J-T,

Is it always the same picture you're after? Or will the url change?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
> Thanks for the reply.
>
> I used the way that you suggested ,but the problem is that it is
> returing relative path to the picture which is in the page and
> because that picture dosen;t exist in my website ,the picture is not
> showig up well.Page contains a relative path to the picture and page
> is not part of my website,I am getting its content from a website to
> which I have to access.When I use iframe the whole page is rendered
> and then I don;t care about the paths in the page.
>
> Any suggesions?
>
> Thanks agian
> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
> in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>> Another possibility would be to use a web request and a literal
>> control. This is the method I prefer because you can check if the
>> request is valid and handle the possibility of the page you're
>> requesting not showing up...
>>
>> Something along these lines:
>>
>> '---Create the request
>>
>> Dim WebRequest As System.Net.WebRequest =
>> System.Net.WebRequest.Create(New
>> Uri(CurrentLink))
>>
>> WebRequest.Timeout = 2000
>>
>> '---Get the response produced by the request
>>
>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>
>> '---Download the page content into a stream
>>
>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>
>> '---Place the stream into a stream reader
>>
>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>
>> '---Read the stream into a string object
>>
>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>
>> '---Place the string into a literal control
>>
>> Literal1.Text = HtmlReceived
>>
>> '---Cleanup
>>
>> Stream.Close()
>>
>> StreamReader.Close()
>>
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>> Yep! <iframe> will do.
>>>
>>> <iframe
>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>
>>>
>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>> I'd try an <iframe> element.
>>>>
>>>> HTH,
>>>> Axel Dahmen
>>>>
>>>>
>>>>
>>>> ------------------
>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>> Hi All,
>>>>>
>>>>> There is a picture on the following URL which I want to have it in
>>>>> one of
>>>>> my asp.net pages .I mean I want to embed the content of this page
>>>>> in my
>>>> own
>>>>> page and get its image.Is there a control or tecnique which I can
>>>>> accomplish this?
>>>>>
>>>>>
>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>
>>>>> Thanks a lot
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #11
Oh, and change the content type in the code from jpg to gif.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:u9***************@tk2msftngp13.phx.gbl...
Sorry,I guessed I am misleading you by bad explanation.

The source is a page that contains the image :

http://www.tehrantraffic.com/gif.asp...TTCC%20website

page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg !The
picture is being updated every 2 minues and that's why I need to update my
hosting user control in 2 minutes as well to show latest picture.I have no
access to the image so any relative path to the image dosen;t work,the
only thing I have access to is the URL I mentioned above.

Thanks a lot for the help

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eU**************@TK2MSFTNGP12.phx.gbl...
In that case you could create a .aspx page that sends the image to you
using the response object.

You would then set the link of your image to the imagedelivery.aspx page.

The code for the delivery page would be like this:

'------------------------------------------------------------------------------------------
'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo DateModified:
By:
'
' Comments:
' Delivers an image from the image table stored in memory as a
stream.
'------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MemoryStream As System.IO.Stream
Try
Response.Clear()
Response.ContentType = "image/jpeg"

Dim ImageWebRequest As System.Net.WebRequest

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.mywebapp/uri of image here.jpg"))
ImageWebRequest.Timeout = 2000

'---Get the response produced by the request
Dim Response As System.Net.WebResponse =
ImageWebRequest.GetResponse

'---Download the page content into a stream
MemoryStream = Response.GetResponseStream

Response.BinaryWrite(MemoryStream.GetBuffer)
Catch ex As Exception
'---Handle any errors here.
Finally
If Not MemoryStream Is Nothing Then
MemoryStream.Close()
MemoryStream = Nothing
End If
End Try
End Sub
Then set your link to the image delivery page. You could even tack on a
random number as a querystring id to the default page's url each page
load something like:

Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
Rnd.ToString & Rnd.ToString

The query string will make the client browser think that the image url
has changed every page load. Thus, no caching of images.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:eD*************@tk2msftngp13.phx.gbl...

Always same picture.URL never gets changed!!!

Thanks

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eD*************@TK2MSFTNGP11.phx.gbl...
J-T,

Is it always the same picture you're after? Or will the url change?

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
> Thanks for the reply.
>
> I used the way that you suggested ,but the problem is that it is
> returing relative path to the picture which is in the page and
> because that picture dosen;t exist in my website ,the picture is not
> showig up well.Page contains a relative path to the picture and page
> is not part of my website,I am getting its content from a website to
> which I have to access.When I use iframe the whole page is rendered
> and then I don;t care about the paths in the page.
>
> Any suggesions?
>
> Thanks agian
> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
> in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>> Another possibility would be to use a web request and a literal
>> control. This is the method I prefer because you can check if the
>> request is valid and handle the possibility of the page you're
>> requesting not showing up...
>>
>> Something along these lines:
>>
>> '---Create the request
>>
>> Dim WebRequest As System.Net.WebRequest =
>> System.Net.WebRequest.Create(New
>> Uri(CurrentLink))
>>
>> WebRequest.Timeout = 2000
>>
>> '---Get the response produced by the request
>>
>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>
>> '---Download the page content into a stream
>>
>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>
>> '---Place the stream into a stream reader
>>
>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>
>> '---Read the stream into a string object
>>
>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>
>> '---Place the string into a literal control
>>
>> Literal1.Text = HtmlReceived
>>
>> '---Cleanup
>>
>> Stream.Close()
>>
>> StreamReader.Close()
>>
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>> Yep! <iframe> will do.
>>>
>>> <iframe
>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>
>>>
>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>> I'd try an <iframe> element.
>>>>
>>>> HTH,
>>>> Axel Dahmen
>>>>
>>>>
>>>>
>>>> ------------------
>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>> Hi All,
>>>>>
>>>>> There is a picture on the following URL which I want to have it in
>>>>> one of
>>>>> my asp.net pages .I mean I want to embed the content of this page
>>>>> in my
>>>> own
>>>>> page and get its image.Is there a control or tecnique which I can
>>>>> accomplish this?
>>>>>
>>>>>
>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>
>>>>> Thanks a lot
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #12
J-T
That's cool.I didn;t know that I can have access to that image directly
through the url.You probably found it from its relative path .I didn;t
notice that .Good point .

Now that I have the url of the picture ,rather than the url of the hosting
page ,I guess it is easier to follow.The only question is this line of code:
Response.BinaryWrite(MemoryStream.GetBuffer)
I am using C# and MemoryStream of type System.IO.Stream dosesn;t give me the
GetBuffer method? How can I get that method?

I so appreciate your help
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:e8**************@tk2msftngp13.phx.gbl...
Oh, and change the content type in the code from jpg to gif.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:u9***************@tk2msftngp13.phx.gbl...
Sorry,I guessed I am misleading you by bad explanation.

The source is a page that contains the image :

http://www.tehrantraffic.com/gif.asp...TTCC%20website

page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg !The
picture is being updated every 2 minues and that's why I need to update
my hosting user control in 2 minutes as well to show latest picture.I
have no access to the image so any relative path to the image dosen;t
work,the only thing I have access to is the URL I mentioned above.

Thanks a lot for the help

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eU**************@TK2MSFTNGP12.phx.gbl...
In that case you could create a .aspx page that sends the image to you
using the response object.

You would then set the link of your image to the imagedelivery.aspx
page.

The code for the delivery page would be like this:

'------------------------------------------------------------------------------------------
'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo
DateModified: By:
'
' Comments:
' Delivers an image from the image table stored in memory as a
stream.
'------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MemoryStream As System.IO.Stream
Try
Response.Clear()
Response.ContentType = "image/jpeg"

Dim ImageWebRequest As System.Net.WebRequest

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.mywebapp/uri of image here.jpg"))
ImageWebRequest.Timeout = 2000

'---Get the response produced by the request
Dim Response As System.Net.WebResponse =
ImageWebRequest.GetResponse

'---Download the page content into a stream
MemoryStream = Response.GetResponseStream

Response.BinaryWrite(MemoryStream.GetBuffer)
Catch ex As Exception
'---Handle any errors here.
Finally
If Not MemoryStream Is Nothing Then
MemoryStream.Close()
MemoryStream = Nothing
End If
End Try
End Sub
Then set your link to the image delivery page. You could even tack on a
random number as a querystring id to the default page's url each page
load something like:

Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
Rnd.ToString & Rnd.ToString

The query string will make the client browser think that the image url
has changed every page load. Thus, no caching of images.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:eD*************@tk2msftngp13.phx.gbl...

Always same picture.URL never gets changed!!!

Thanks

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eD*************@TK2MSFTNGP11.phx.gbl...
> J-T,
>
> Is it always the same picture you're after? Or will the url change?
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "J-T" <J-*@nospam.com> wrote in message
> news:ew**************@TK2MSFTNGP11.phx.gbl...
>> Thanks for the reply.
>>
>> I used the way that you suggested ,but the problem is that it is
>> returing relative path to the picture which is in the page and
>> because that picture dosen;t exist in my website ,the picture is not
>> showig up well.Page contains a relative path to the picture and page
>> is not part of my website,I am getting its content from a website to
>> which I have to access.When I use iframe the whole page is rendered
>> and then I don;t care about the paths in the page.
>>
>> Any suggesions?
>>
>> Thanks agian
>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
>> in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>>> Another possibility would be to use a web request and a literal
>>> control. This is the method I prefer because you can check if the
>>> request is valid and handle the possibility of the page you're
>>> requesting not showing up...
>>>
>>> Something along these lines:
>>>
>>> '---Create the request
>>>
>>> Dim WebRequest As System.Net.WebRequest =
>>> System.Net.WebRequest.Create(New
>>> Uri(CurrentLink))
>>>
>>> WebRequest.Timeout = 2000
>>>
>>> '---Get the response produced by the request
>>>
>>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>>
>>> '---Download the page content into a stream
>>>
>>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>>
>>> '---Place the stream into a stream reader
>>>
>>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>>
>>> '---Read the stream into a string object
>>>
>>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>>
>>> '---Place the string into a literal control
>>>
>>> Literal1.Text = HtmlReceived
>>>
>>> '---Cleanup
>>>
>>> Stream.Close()
>>>
>>> StreamReader.Close()
>>>
>>>
>>> --
>>> Sincerely,
>>>
>>> S. Justin Gengo, MCP
>>> Web Developer / Programmer
>>>
>>> www.aboutfortunate.com
>>>
>>> "Out of chaos comes order."
>>> Nietzsche
>>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>>> Yep! <iframe> will do.
>>>>
>>>> <iframe
>>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>>
>>>>
>>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>>> I'd try an <iframe> element.
>>>>>
>>>>> HTH,
>>>>> Axel Dahmen
>>>>>
>>>>>
>>>>>
>>>>> ------------------
>>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>>> Hi All,
>>>>>>
>>>>>> There is a picture on the following URL which I want to have it
>>>>>> in one of
>>>>>> my asp.net pages .I mean I want to embed the content of this page
>>>>>> in my
>>>>> own
>>>>>> page and get its image.Is there a control or tecnique which I
>>>>>> can
>>>>>> accomplish this?
>>>>>>
>>>>>>
>>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>>
>>>>>> Thanks a lot
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #13
J-T,

Actually, it's even easier than that...

You don't even need the page I created at all, unless you want to double
check that the image is available.

If you don't care if it doesn't show up every now and then you could just
set your image url directly to it.

again I'd tag on random numbers to the query string to stop caching...

http://www.tehrantraffic.com/cam3_ttcc_00001.jpg?id=2

But if you do want to check whether the image is being delivered or not then
the GetBuffer method is available from C# also...

Try it out:

Response.Clear;

Response.ContentType = "image/gif";
System.Net.WebRequest ImageWebRequest;

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.tehrantraffic.com/cam3_ttcc_00001.jpg"));

System.Net.WebResponse WebResponse = ImageWebRequest.GetResponse;

System.IO.MemoryStream MemoryStream = Response.GetResponseStream;
MemoryStream.GetBuffer();
Response.BinaryWrite(MemoryStream.GetBuffer);
MemoryStream.Close();

MemoryStream = Nothing;

Oh, and i think I know why you don't see the GetBuffer method... You are
probably not seeing quite a few interesting methods...

In Visual Studio go to the menu and click Tools - Options.

In the window that opens Click the "Text Editor" folder in the left hand
pane. Then Click the "C#" folder.

In the Right hand pane uncheck the "Hide Advance Members" checkbox.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl...
That's cool.I didn;t know that I can have access to that image directly
through the url.You probably found it from its relative path .I didn;t
notice that .Good point .

Now that I have the url of the picture ,rather than the url of the hosting
page ,I guess it is easier to follow.The only question is this line of
code:
Response.BinaryWrite(MemoryStream.GetBuffer)
I am using C# and MemoryStream of type System.IO.Stream dosesn;t give me
the GetBuffer method? How can I get that method?

I so appreciate your help
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:e8**************@tk2msftngp13.phx.gbl...
Oh, and change the content type in the code from jpg to gif.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:u9***************@tk2msftngp13.phx.gbl...
Sorry,I guessed I am misleading you by bad explanation.

The source is a page that contains the image :

http://www.tehrantraffic.com/gif.asp...TTCC%20website

page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg !The
picture is being updated every 2 minues and that's why I need to update
my hosting user control in 2 minutes as well to show latest picture.I
have no access to the image so any relative path to the image dosen;t
work,the only thing I have access to is the URL I mentioned above.

Thanks a lot for the help

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eU**************@TK2MSFTNGP12.phx.gbl...
In that case you could create a .aspx page that sends the image to you
using the response object.

You would then set the link of your image to the imagedelivery.aspx
page.

The code for the delivery page would be like this:

'------------------------------------------------------------------------------------------
'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo
DateModified: By:
'
' Comments:
' Delivers an image from the image table stored in memory as a
stream.
'------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim MemoryStream As System.IO.Stream
Try
Response.Clear()
Response.ContentType = "image/jpeg"

Dim ImageWebRequest As System.Net.WebRequest

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.mywebapp/uri of image here.jpg"))
ImageWebRequest.Timeout = 2000

'---Get the response produced by the request
Dim Response As System.Net.WebResponse =
ImageWebRequest.GetResponse

'---Download the page content into a stream
MemoryStream = Response.GetResponseStream

Response.BinaryWrite(MemoryStream.GetBuffer)
Catch ex As Exception
'---Handle any errors here.
Finally
If Not MemoryStream Is Nothing Then
MemoryStream.Close()
MemoryStream = Nothing
End If
End Try
End Sub
Then set your link to the image delivery page. You could even tack on a
random number as a querystring id to the default page's url each page
load something like:

Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
Rnd.ToString & Rnd.ToString

The query string will make the client browser think that the image url
has changed every page load. Thus, no caching of images.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:eD*************@tk2msftngp13.phx.gbl...
>
> Always same picture.URL never gets changed!!!
>
> Thanks
>
> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
> in message news:eD*************@TK2MSFTNGP11.phx.gbl...
>> J-T,
>>
>> Is it always the same picture you're after? Or will the url change?
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "J-T" <J-*@nospam.com> wrote in message
>> news:ew**************@TK2MSFTNGP11.phx.gbl...
>>> Thanks for the reply.
>>>
>>> I used the way that you suggested ,but the problem is that it is
>>> returing relative path to the picture which is in the page and
>>> because that picture dosen;t exist in my website ,the picture is not
>>> showig up well.Page contains a relative path to the picture and page
>>> is not part of my website,I am getting its content from a website to
>>> which I have to access.When I use iframe the whole page is rendered
>>> and then I don;t care about the paths in the page.
>>>
>>> Any suggesions?
>>>
>>> Thanks agian
>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
>>> in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>>>> Another possibility would be to use a web request and a literal
>>>> control. This is the method I prefer because you can check if the
>>>> request is valid and handle the possibility of the page you're
>>>> requesting not showing up...
>>>>
>>>> Something along these lines:
>>>>
>>>> '---Create the request
>>>>
>>>> Dim WebRequest As System.Net.WebRequest =
>>>> System.Net.WebRequest.Create(New
>>>> Uri(CurrentLink))
>>>>
>>>> WebRequest.Timeout = 2000
>>>>
>>>> '---Get the response produced by the request
>>>>
>>>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>>>
>>>> '---Download the page content into a stream
>>>>
>>>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>>>
>>>> '---Place the stream into a stream reader
>>>>
>>>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>>>
>>>> '---Read the stream into a string object
>>>>
>>>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>>>
>>>> '---Place the string into a literal control
>>>>
>>>> Literal1.Text = HtmlReceived
>>>>
>>>> '---Cleanup
>>>>
>>>> Stream.Close()
>>>>
>>>> StreamReader.Close()
>>>>
>>>>
>>>> --
>>>> Sincerely,
>>>>
>>>> S. Justin Gengo, MCP
>>>> Web Developer / Programmer
>>>>
>>>> www.aboutfortunate.com
>>>>
>>>> "Out of chaos comes order."
>>>> Nietzsche
>>>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>>>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>>>> Yep! <iframe> will do.
>>>>>
>>>>> <iframe
>>>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>>>
>>>>>
>>>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>>>> I'd try an <iframe> element.
>>>>>>
>>>>>> HTH,
>>>>>> Axel Dahmen
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------
>>>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>>>> Hi All,
>>>>>>>
>>>>>>> There is a picture on the following URL which I want to have it
>>>>>>> in one of
>>>>>>> my asp.net pages .I mean I want to embed the content of this
>>>>>>> page in my
>>>>>> own
>>>>>>> page and get its image.Is there a control or tecnique which I
>>>>>>> can
>>>>>>> accomplish this?
>>>>>>>
>>>>>>>
>>>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>>>
>>>>>>> Thanks a lot
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #14
J-T
Justin,

I really appreciate your vauable help.The reason I was not able to see the
GetBuffer method was that in the previous code you created MemoryStream
from
System.IO.Stream and now you changed it to MemoryStream :-) I just wondered
that why you have chosen the name of memory stream and then creaed your
object from Stream class !!

No problem .I am going to implement it and let you know if there is any
problem by the end of today .Thanks a lot again

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eJ****************@TK2MSFTNGP09.phx.gbl...
J-T,

Actually, it's even easier than that...

You don't even need the page I created at all, unless you want to double
check that the image is available.

If you don't care if it doesn't show up every now and then you could just
set your image url directly to it.

again I'd tag on random numbers to the query string to stop caching...

http://www.tehrantraffic.com/cam3_ttcc_00001.jpg?id=2

But if you do want to check whether the image is being delivered or not
then the GetBuffer method is available from C# also...

Try it out:

Response.Clear;

Response.ContentType = "image/gif";
System.Net.WebRequest ImageWebRequest;

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.tehrantraffic.com/cam3_ttcc_00001.jpg"));

System.Net.WebResponse WebResponse = ImageWebRequest.GetResponse;

System.IO.MemoryStream MemoryStream = Response.GetResponseStream;
MemoryStream.GetBuffer();
Response.BinaryWrite(MemoryStream.GetBuffer);
MemoryStream.Close();

MemoryStream = Nothing;

Oh, and i think I know why you don't see the GetBuffer method... You are
probably not seeing quite a few interesting methods...

In Visual Studio go to the menu and click Tools - Options.

In the window that opens Click the "Text Editor" folder in the left hand
pane. Then Click the "C#" folder.

In the Right hand pane uncheck the "Hide Advance Members" checkbox.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl...
That's cool.I didn;t know that I can have access to that image directly
through the url.You probably found it from its relative path .I didn;t
notice that .Good point .

Now that I have the url of the picture ,rather than the url of the
hosting page ,I guess it is easier to follow.The only question is this
line of code:
Response.BinaryWrite(MemoryStream.GetBuffer)
I am using C# and MemoryStream of type System.IO.Stream dosesn;t give me
the GetBuffer method? How can I get that method?

I so appreciate your help
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:e8**************@tk2msftngp13.phx.gbl...
Oh, and change the content type in the code from jpg to gif.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:u9***************@tk2msftngp13.phx.gbl...
Sorry,I guessed I am misleading you by bad explanation.

The source is a page that contains the image :

http://www.tehrantraffic.com/gif.asp...TTCC%20website

page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg !The
picture is being updated every 2 minues and that's why I need to update
my hosting user control in 2 minutes as well to show latest picture.I
have no access to the image so any relative path to the image dosen;t
work,the only thing I have access to is the URL I mentioned above.

Thanks a lot for the help

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eU**************@TK2MSFTNGP12.phx.gbl...
> In that case you could create a .aspx page that sends the image to you
> using the response object.
>
> You would then set the link of your image to the imagedelivery.aspx
> page.
>
> The code for the delivery page would be like this:
>
> '------------------------------------------------------------------------------------------
> 'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo
> DateModified: By:
> '
> ' Comments:
> ' Delivers an image from the image table stored in memory as a
> stream.
> '------------------------------------------------------------------------------------------
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Dim MemoryStream As System.IO.Stream
> Try
> Response.Clear()
> Response.ContentType = "image/jpeg"
>
> Dim ImageWebRequest As System.Net.WebRequest
>
> ImageWebRequest = System.Net.WebRequest.Create(New
> Uri("http://www.mywebapp/uri of image here.jpg"))
> ImageWebRequest.Timeout = 2000
>
> '---Get the response produced by the request
> Dim Response As System.Net.WebResponse =
> ImageWebRequest.GetResponse
>
> '---Download the page content into a stream
> MemoryStream = Response.GetResponseStream
>
> Response.BinaryWrite(MemoryStream.GetBuffer)
> Catch ex As Exception
> '---Handle any errors here.
> Finally
> If Not MemoryStream Is Nothing Then
> MemoryStream.Close()
> MemoryStream = Nothing
> End If
> End Try
> End Sub
>
>
> Then set your link to the image delivery page. You could even tack on
> a random number as a querystring id to the default page's url each
> page load something like:
>
> Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
> Rnd.ToString & Rnd.ToString
>
> The query string will make the client browser think that the image url
> has changed every page load. Thus, no caching of images.
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "J-T" <J-*@nospam.com> wrote in message
> news:eD*************@tk2msftngp13.phx.gbl...
>>
>> Always same picture.URL never gets changed!!!
>>
>> Thanks
>>
>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
>> in message news:eD*************@TK2MSFTNGP11.phx.gbl...
>>> J-T,
>>>
>>> Is it always the same picture you're after? Or will the url change?
>>>
>>> --
>>> Sincerely,
>>>
>>> S. Justin Gengo, MCP
>>> Web Developer / Programmer
>>>
>>> www.aboutfortunate.com
>>>
>>> "Out of chaos comes order."
>>> Nietzsche
>>> "J-T" <J-*@nospam.com> wrote in message
>>> news:ew**************@TK2MSFTNGP11.phx.gbl...
>>>> Thanks for the reply.
>>>>
>>>> I used the way that you suggested ,but the problem is that it is
>>>> returing relative path to the picture which is in the page and
>>>> because that picture dosen;t exist in my website ,the picture is
>>>> not showig up well.Page contains a relative path to the picture and
>>>> page is not part of my website,I am getting its content from a
>>>> website to which I have to access.When I use iframe the whole page
>>>> is rendered and then I don;t care about the paths in the page.
>>>>
>>>> Any suggesions?
>>>>
>>>> Thanks agian
>>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com>
>>>> wrote in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>>>>> Another possibility would be to use a web request and a literal
>>>>> control. This is the method I prefer because you can check if the
>>>>> request is valid and handle the possibility of the page you're
>>>>> requesting not showing up...
>>>>>
>>>>> Something along these lines:
>>>>>
>>>>> '---Create the request
>>>>>
>>>>> Dim WebRequest As System.Net.WebRequest =
>>>>> System.Net.WebRequest.Create(New
>>>>> Uri(CurrentLink))
>>>>>
>>>>> WebRequest.Timeout = 2000
>>>>>
>>>>> '---Get the response produced by the request
>>>>>
>>>>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>>>>
>>>>> '---Download the page content into a stream
>>>>>
>>>>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>>>>
>>>>> '---Place the stream into a stream reader
>>>>>
>>>>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>>>>
>>>>> '---Read the stream into a string object
>>>>>
>>>>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>>>>
>>>>> '---Place the string into a literal control
>>>>>
>>>>> Literal1.Text = HtmlReceived
>>>>>
>>>>> '---Cleanup
>>>>>
>>>>> Stream.Close()
>>>>>
>>>>> StreamReader.Close()
>>>>>
>>>>>
>>>>> --
>>>>> Sincerely,
>>>>>
>>>>> S. Justin Gengo, MCP
>>>>> Web Developer / Programmer
>>>>>
>>>>> www.aboutfortunate.com
>>>>>
>>>>> "Out of chaos comes order."
>>>>> Nietzsche
>>>>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>>>>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>>>>> Yep! <iframe> will do.
>>>>>>
>>>>>> <iframe
>>>>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>>>>
>>>>>>
>>>>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>>>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>>>>> I'd try an <iframe> element.
>>>>>>>
>>>>>>> HTH,
>>>>>>> Axel Dahmen
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------
>>>>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> There is a picture on the following URL which I want to have it
>>>>>>>> in one of
>>>>>>>> my asp.net pages .I mean I want to embed the content of this
>>>>>>>> page in my
>>>>>>> own
>>>>>>>> page and get its image.Is there a control or tecnique which I
>>>>>>>> can
>>>>>>>> accomplish this?
>>>>>>>>
>>>>>>>>
>>>>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>>>>
>>>>>>>> Thanks a lot
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #15
J-T
Justine,

I guess my other question is that if I want to get 4 of these pitures at
four differnet URLs ,is the solution still applicable?

Thanks
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eJ****************@TK2MSFTNGP09.phx.gbl...
J-T,

Actually, it's even easier than that...

You don't even need the page I created at all, unless you want to double
check that the image is available.

If you don't care if it doesn't show up every now and then you could just
set your image url directly to it.

again I'd tag on random numbers to the query string to stop caching...

http://www.tehrantraffic.com/cam3_ttcc_00001.jpg?id=2

But if you do want to check whether the image is being delivered or not
then the GetBuffer method is available from C# also...

Try it out:

Response.Clear;

Response.ContentType = "image/gif";
System.Net.WebRequest ImageWebRequest;

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.tehrantraffic.com/cam3_ttcc_00001.jpg"));

System.Net.WebResponse WebResponse = ImageWebRequest.GetResponse;

System.IO.MemoryStream MemoryStream = Response.GetResponseStream;
MemoryStream.GetBuffer();
Response.BinaryWrite(MemoryStream.GetBuffer);
MemoryStream.Close();

MemoryStream = Nothing;

Oh, and i think I know why you don't see the GetBuffer method... You are
probably not seeing quite a few interesting methods...

In Visual Studio go to the menu and click Tools - Options.

In the window that opens Click the "Text Editor" folder in the left hand
pane. Then Click the "C#" folder.

In the Right hand pane uncheck the "Hide Advance Members" checkbox.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl...
That's cool.I didn;t know that I can have access to that image directly
through the url.You probably found it from its relative path .I didn;t
notice that .Good point .

Now that I have the url of the picture ,rather than the url of the
hosting page ,I guess it is easier to follow.The only question is this
line of code:
Response.BinaryWrite(MemoryStream.GetBuffer)
I am using C# and MemoryStream of type System.IO.Stream dosesn;t give me
the GetBuffer method? How can I get that method?

I so appreciate your help
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:e8**************@tk2msftngp13.phx.gbl...
Oh, and change the content type in the code from jpg to gif.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:u9***************@tk2msftngp13.phx.gbl...
Sorry,I guessed I am misleading you by bad explanation.

The source is a page that contains the image :

http://www.tehrantraffic.com/gif.asp...TTCC%20website

page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg !The
picture is being updated every 2 minues and that's why I need to update
my hosting user control in 2 minutes as well to show latest picture.I
have no access to the image so any relative path to the image dosen;t
work,the only thing I have access to is the URL I mentioned above.

Thanks a lot for the help

"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eU**************@TK2MSFTNGP12.phx.gbl...
> In that case you could create a .aspx page that sends the image to you
> using the response object.
>
> You would then set the link of your image to the imagedelivery.aspx
> page.
>
> The code for the delivery page would be like this:
>
> '------------------------------------------------------------------------------------------
> 'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo
> DateModified: By:
> '
> ' Comments:
> ' Delivers an image from the image table stored in memory as a
> stream.
> '------------------------------------------------------------------------------------------
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> Dim MemoryStream As System.IO.Stream
> Try
> Response.Clear()
> Response.ContentType = "image/jpeg"
>
> Dim ImageWebRequest As System.Net.WebRequest
>
> ImageWebRequest = System.Net.WebRequest.Create(New
> Uri("http://www.mywebapp/uri of image here.jpg"))
> ImageWebRequest.Timeout = 2000
>
> '---Get the response produced by the request
> Dim Response As System.Net.WebResponse =
> ImageWebRequest.GetResponse
>
> '---Download the page content into a stream
> MemoryStream = Response.GetResponseStream
>
> Response.BinaryWrite(MemoryStream.GetBuffer)
> Catch ex As Exception
> '---Handle any errors here.
> Finally
> If Not MemoryStream Is Nothing Then
> MemoryStream.Close()
> MemoryStream = Nothing
> End If
> End Try
> End Sub
>
>
> Then set your link to the image delivery page. You could even tack on
> a random number as a querystring id to the default page's url each
> page load something like:
>
> Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
> Rnd.ToString & Rnd.ToString
>
> The query string will make the client browser think that the image url
> has changed every page load. Thus, no caching of images.
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "J-T" <J-*@nospam.com> wrote in message
> news:eD*************@tk2msftngp13.phx.gbl...
>>
>> Always same picture.URL never gets changed!!!
>>
>> Thanks
>>
>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
>> in message news:eD*************@TK2MSFTNGP11.phx.gbl...
>>> J-T,
>>>
>>> Is it always the same picture you're after? Or will the url change?
>>>
>>> --
>>> Sincerely,
>>>
>>> S. Justin Gengo, MCP
>>> Web Developer / Programmer
>>>
>>> www.aboutfortunate.com
>>>
>>> "Out of chaos comes order."
>>> Nietzsche
>>> "J-T" <J-*@nospam.com> wrote in message
>>> news:ew**************@TK2MSFTNGP11.phx.gbl...
>>>> Thanks for the reply.
>>>>
>>>> I used the way that you suggested ,but the problem is that it is
>>>> returing relative path to the picture which is in the page and
>>>> because that picture dosen;t exist in my website ,the picture is
>>>> not showig up well.Page contains a relative path to the picture and
>>>> page is not part of my website,I am getting its content from a
>>>> website to which I have to access.When I use iframe the whole page
>>>> is rendered and then I don;t care about the paths in the page.
>>>>
>>>> Any suggesions?
>>>>
>>>> Thanks agian
>>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com>
>>>> wrote in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>>>>> Another possibility would be to use a web request and a literal
>>>>> control. This is the method I prefer because you can check if the
>>>>> request is valid and handle the possibility of the page you're
>>>>> requesting not showing up...
>>>>>
>>>>> Something along these lines:
>>>>>
>>>>> '---Create the request
>>>>>
>>>>> Dim WebRequest As System.Net.WebRequest =
>>>>> System.Net.WebRequest.Create(New
>>>>> Uri(CurrentLink))
>>>>>
>>>>> WebRequest.Timeout = 2000
>>>>>
>>>>> '---Get the response produced by the request
>>>>>
>>>>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>>>>
>>>>> '---Download the page content into a stream
>>>>>
>>>>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>>>>
>>>>> '---Place the stream into a stream reader
>>>>>
>>>>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>>>>
>>>>> '---Read the stream into a string object
>>>>>
>>>>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>>>>
>>>>> '---Place the string into a literal control
>>>>>
>>>>> Literal1.Text = HtmlReceived
>>>>>
>>>>> '---Cleanup
>>>>>
>>>>> Stream.Close()
>>>>>
>>>>> StreamReader.Close()
>>>>>
>>>>>
>>>>> --
>>>>> Sincerely,
>>>>>
>>>>> S. Justin Gengo, MCP
>>>>> Web Developer / Programmer
>>>>>
>>>>> www.aboutfortunate.com
>>>>>
>>>>> "Out of chaos comes order."
>>>>> Nietzsche
>>>>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>>>>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>>>>> Yep! <iframe> will do.
>>>>>>
>>>>>> <iframe
>>>>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>>>>
>>>>>>
>>>>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>>>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>>>>> I'd try an <iframe> element.
>>>>>>>
>>>>>>> HTH,
>>>>>>> Axel Dahmen
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------
>>>>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> There is a picture on the following URL which I want to have it
>>>>>>>> in one of
>>>>>>>> my asp.net pages .I mean I want to embed the content of this
>>>>>>>> page in my
>>>>>>> own
>>>>>>>> page and get its image.Is there a control or tecnique which I
>>>>>>>> can
>>>>>>>> accomplish this?
>>>>>>>>
>>>>>>>>
>>>>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>>>>
>>>>>>>> Thanks a lot
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #16
J-T,

Sorry about the stream name mixup...

Yes, this solution would still be viable. For example you coud right a
Select Case statement that would pick which url to grab based on querystring
input...
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Justine,

I guess my other question is that if I want to get 4 of these pitures at
four differnet URLs ,is the solution still applicable?

Thanks
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eJ****************@TK2MSFTNGP09.phx.gbl...
J-T,

Actually, it's even easier than that...

You don't even need the page I created at all, unless you want to double
check that the image is available.

If you don't care if it doesn't show up every now and then you could just
set your image url directly to it.

again I'd tag on random numbers to the query string to stop caching...

http://www.tehrantraffic.com/cam3_ttcc_00001.jpg?id=2

But if you do want to check whether the image is being delivered or not
then the GetBuffer method is available from C# also...

Try it out:

Response.Clear;

Response.ContentType = "image/gif";
System.Net.WebRequest ImageWebRequest;

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.tehrantraffic.com/cam3_ttcc_00001.jpg"));

System.Net.WebResponse WebResponse = ImageWebRequest.GetResponse;

System.IO.MemoryStream MemoryStream = Response.GetResponseStream;
MemoryStream.GetBuffer();
Response.BinaryWrite(MemoryStream.GetBuffer);
MemoryStream.Close();

MemoryStream = Nothing;

Oh, and i think I know why you don't see the GetBuffer method... You are
probably not seeing quite a few interesting methods...

In Visual Studio go to the menu and click Tools - Options.

In the window that opens Click the "Text Editor" folder in the left hand
pane. Then Click the "C#" folder.

In the Right hand pane uncheck the "Hide Advance Members" checkbox.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl...
That's cool.I didn;t know that I can have access to that image directly
through the url.You probably found it from its relative path .I didn;t
notice that .Good point .

Now that I have the url of the picture ,rather than the url of the
hosting page ,I guess it is easier to follow.The only question is this
line of code:
Response.BinaryWrite(MemoryStream.GetBuffer)
I am using C# and MemoryStream of type System.IO.Stream dosesn;t give me
the GetBuffer method? How can I get that method?

I so appreciate your help
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:e8**************@tk2msftngp13.phx.gbl...
Oh, and change the content type in the code from jpg to gif.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:u9***************@tk2msftngp13.phx.gbl...
> Sorry,I guessed I am misleading you by bad explanation.
>
> The source is a page that contains the image :
>
> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>
> page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg
> !The picture is being updated every 2 minues and that's why I need to
> update my hosting user control in 2 minutes as well to show latest
> picture.I have no access to the image so any relative path to the
> image dosen;t work,the only thing I have access to is the URL I
> mentioned above.
>
> Thanks a lot for the help
>
> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
> in message news:eU**************@TK2MSFTNGP12.phx.gbl...
>> In that case you could create a .aspx page that sends the image to
>> you using the response object.
>>
>> You would then set the link of your image to the imagedelivery.aspx
>> page.
>>
>> The code for the delivery page would be like this:
>>
>> '------------------------------------------------------------------------------------------
>> 'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo
>> DateModified: By:
>> '
>> ' Comments:
>> ' Delivers an image from the image table stored in memory as a
>> stream.
>> '------------------------------------------------------------------------------------------
>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
>> System.EventArgs) Handles MyBase.Load
>> Dim MemoryStream As System.IO.Stream
>> Try
>> Response.Clear()
>> Response.ContentType = "image/jpeg"
>>
>> Dim ImageWebRequest As System.Net.WebRequest
>>
>> ImageWebRequest = System.Net.WebRequest.Create(New
>> Uri("http://www.mywebapp/uri of image here.jpg"))
>> ImageWebRequest.Timeout = 2000
>>
>> '---Get the response produced by the request
>> Dim Response As System.Net.WebResponse =
>> ImageWebRequest.GetResponse
>>
>> '---Download the page content into a stream
>> MemoryStream = Response.GetResponseStream
>>
>> Response.BinaryWrite(MemoryStream.GetBuffer)
>> Catch ex As Exception
>> '---Handle any errors here.
>> Finally
>> If Not MemoryStream Is Nothing Then
>> MemoryStream.Close()
>> MemoryStream = Nothing
>> End If
>> End Try
>> End Sub
>>
>>
>> Then set your link to the image delivery page. You could even tack on
>> a random number as a querystring id to the default page's url each
>> page load something like:
>>
>> Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
>> Rnd.ToString & Rnd.ToString
>>
>> The query string will make the client browser think that the image
>> url has changed every page load. Thus, no caching of images.
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "J-T" <J-*@nospam.com> wrote in message
>> news:eD*************@tk2msftngp13.phx.gbl...
>>>
>>> Always same picture.URL never gets changed!!!
>>>
>>> Thanks
>>>
>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
>>> in message news:eD*************@TK2MSFTNGP11.phx.gbl...
>>>> J-T,
>>>>
>>>> Is it always the same picture you're after? Or will the url change?
>>>>
>>>> --
>>>> Sincerely,
>>>>
>>>> S. Justin Gengo, MCP
>>>> Web Developer / Programmer
>>>>
>>>> www.aboutfortunate.com
>>>>
>>>> "Out of chaos comes order."
>>>> Nietzsche
>>>> "J-T" <J-*@nospam.com> wrote in message
>>>> news:ew**************@TK2MSFTNGP11.phx.gbl...
>>>>> Thanks for the reply.
>>>>>
>>>>> I used the way that you suggested ,but the problem is that it is
>>>>> returing relative path to the picture which is in the page and
>>>>> because that picture dosen;t exist in my website ,the picture is
>>>>> not showig up well.Page contains a relative path to the picture
>>>>> and page is not part of my website,I am getting its content from a
>>>>> website to which I have to access.When I use iframe the whole page
>>>>> is rendered and then I don;t care about the paths in the page.
>>>>>
>>>>> Any suggesions?
>>>>>
>>>>> Thanks agian
>>>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com>
>>>>> wrote in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>>>>>> Another possibility would be to use a web request and a literal
>>>>>> control. This is the method I prefer because you can check if the
>>>>>> request is valid and handle the possibility of the page you're
>>>>>> requesting not showing up...
>>>>>>
>>>>>> Something along these lines:
>>>>>>
>>>>>> '---Create the request
>>>>>>
>>>>>> Dim WebRequest As System.Net.WebRequest =
>>>>>> System.Net.WebRequest.Create(New
>>>>>> Uri(CurrentLink))
>>>>>>
>>>>>> WebRequest.Timeout = 2000
>>>>>>
>>>>>> '---Get the response produced by the request
>>>>>>
>>>>>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>>>>>
>>>>>> '---Download the page content into a stream
>>>>>>
>>>>>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>>>>>
>>>>>> '---Place the stream into a stream reader
>>>>>>
>>>>>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>>>>>
>>>>>> '---Read the stream into a string object
>>>>>>
>>>>>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>>>>>
>>>>>> '---Place the string into a literal control
>>>>>>
>>>>>> Literal1.Text = HtmlReceived
>>>>>>
>>>>>> '---Cleanup
>>>>>>
>>>>>> Stream.Close()
>>>>>>
>>>>>> StreamReader.Close()
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Sincerely,
>>>>>>
>>>>>> S. Justin Gengo, MCP
>>>>>> Web Developer / Programmer
>>>>>>
>>>>>> www.aboutfortunate.com
>>>>>>
>>>>>> "Out of chaos comes order."
>>>>>> Nietzsche
>>>>>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>>>>>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>>>>>> Yep! <iframe> will do.
>>>>>>>
>>>>>>> <iframe
>>>>>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>>>>>
>>>>>>>
>>>>>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>>>>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>>>>>> I'd try an <iframe> element.
>>>>>>>>
>>>>>>>> HTH,
>>>>>>>> Axel Dahmen
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------
>>>>>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>>>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>>>>>> Hi All,
>>>>>>>>>
>>>>>>>>> There is a picture on the following URL which I want to have
>>>>>>>>> it in one of
>>>>>>>>> my asp.net pages .I mean I want to embed the content of this
>>>>>>>>> page in my
>>>>>>>> own
>>>>>>>>> page and get its image.Is there a control or tecnique which I
>>>>>>>>> can
>>>>>>>>> accomplish this?
>>>>>>>>>
>>>>>>>>>
>>>>>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>>>>>
>>>>>>>>> Thanks a lot
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #17
J-T
Thanks for all the nice help
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
J-T,

Sorry about the stream name mixup...

Yes, this solution would still be viable. For example you coud right a
Select Case statement that would pick which url to grab based on
querystring input...
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Justine,

I guess my other question is that if I want to get 4 of these pitures at
four differnet URLs ,is the solution still applicable?

Thanks
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eJ****************@TK2MSFTNGP09.phx.gbl...
J-T,

Actually, it's even easier than that...

You don't even need the page I created at all, unless you want to double
check that the image is available.

If you don't care if it doesn't show up every now and then you could
just set your image url directly to it.

again I'd tag on random numbers to the query string to stop caching...

http://www.tehrantraffic.com/cam3_ttcc_00001.jpg?id=2

But if you do want to check whether the image is being delivered or not
then the GetBuffer method is available from C# also...

Try it out:

Response.Clear;

Response.ContentType = "image/gif";
System.Net.WebRequest ImageWebRequest;

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.tehrantraffic.com/cam3_ttcc_00001.jpg"));

System.Net.WebResponse WebResponse = ImageWebRequest.GetResponse;

System.IO.MemoryStream MemoryStream = Response.GetResponseStream;
MemoryStream.GetBuffer();
Response.BinaryWrite(MemoryStream.GetBuffer);
MemoryStream.Close();

MemoryStream = Nothing;

Oh, and i think I know why you don't see the GetBuffer method... You are
probably not seeing quite a few interesting methods...

In Visual Studio go to the menu and click Tools - Options.

In the window that opens Click the "Text Editor" folder in the left hand
pane. Then Click the "C#" folder.

In the Right hand pane uncheck the "Hide Advance Members" checkbox.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl...
That's cool.I didn;t know that I can have access to that image directly
through the url.You probably found it from its relative path .I didn;t
notice that .Good point .

Now that I have the url of the picture ,rather than the url of the
hosting page ,I guess it is easier to follow.The only question is this
line of code:
Response.BinaryWrite(MemoryStream.GetBuffer)
I am using C# and MemoryStream of type System.IO.Stream dosesn;t give
me the GetBuffer method? How can I get that method?

I so appreciate your help
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:e8**************@tk2msftngp13.phx.gbl...
> Oh, and change the content type in the code from jpg to gif.
>
> --
> Sincerely,
>
> S. Justin Gengo, MCP
> Web Developer / Programmer
>
> www.aboutfortunate.com
>
> "Out of chaos comes order."
> Nietzsche
> "J-T" <J-*@nospam.com> wrote in message
> news:u9***************@tk2msftngp13.phx.gbl...
>> Sorry,I guessed I am misleading you by bad explanation.
>>
>> The source is a page that contains the image :
>>
>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>
>> page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg
>> !The picture is being updated every 2 minues and that's why I need to
>> update my hosting user control in 2 minutes as well to show latest
>> picture.I have no access to the image so any relative path to the
>> image dosen;t work,the only thing I have access to is the URL I
>> mentioned above.
>>
>> Thanks a lot for the help
>>
>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
>> in message news:eU**************@TK2MSFTNGP12.phx.gbl...
>>> In that case you could create a .aspx page that sends the image to
>>> you using the response object.
>>>
>>> You would then set the link of your image to the imagedelivery.aspx
>>> page.
>>>
>>> The code for the delivery page would be like this:
>>>
>>> '------------------------------------------------------------------------------------------
>>> 'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo
>>> DateModified: By:
>>> '
>>> ' Comments:
>>> ' Delivers an image from the image table stored in memory as a
>>> stream.
>>> '------------------------------------------------------------------------------------------
>>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
>>> System.EventArgs) Handles MyBase.Load
>>> Dim MemoryStream As System.IO.Stream
>>> Try
>>> Response.Clear()
>>> Response.ContentType = "image/jpeg"
>>>
>>> Dim ImageWebRequest As System.Net.WebRequest
>>>
>>> ImageWebRequest = System.Net.WebRequest.Create(New
>>> Uri("http://www.mywebapp/uri of image here.jpg"))
>>> ImageWebRequest.Timeout = 2000
>>>
>>> '---Get the response produced by the request
>>> Dim Response As System.Net.WebResponse =
>>> ImageWebRequest.GetResponse
>>>
>>> '---Download the page content into a stream
>>> MemoryStream = Response.GetResponseStream
>>>
>>> Response.BinaryWrite(MemoryStream.GetBuffer)
>>> Catch ex As Exception
>>> '---Handle any errors here.
>>> Finally
>>> If Not MemoryStream Is Nothing Then
>>> MemoryStream.Close()
>>> MemoryStream = Nothing
>>> End If
>>> End Try
>>> End Sub
>>>
>>>
>>> Then set your link to the image delivery page. You could even tack
>>> on a random number as a querystring id to the default page's url
>>> each page load something like:
>>>
>>> Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id=" &
>>> Rnd.ToString & Rnd.ToString
>>>
>>> The query string will make the client browser think that the image
>>> url has changed every page load. Thus, no caching of images.
>>>
>>> --
>>> Sincerely,
>>>
>>> S. Justin Gengo, MCP
>>> Web Developer / Programmer
>>>
>>> www.aboutfortunate.com
>>>
>>> "Out of chaos comes order."
>>> Nietzsche
>>> "J-T" <J-*@nospam.com> wrote in message
>>> news:eD*************@tk2msftngp13.phx.gbl...
>>>>
>>>> Always same picture.URL never gets changed!!!
>>>>
>>>> Thanks
>>>>
>>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com>
>>>> wrote in message news:eD*************@TK2MSFTNGP11.phx.gbl...
>>>>> J-T,
>>>>>
>>>>> Is it always the same picture you're after? Or will the url
>>>>> change?
>>>>>
>>>>> --
>>>>> Sincerely,
>>>>>
>>>>> S. Justin Gengo, MCP
>>>>> Web Developer / Programmer
>>>>>
>>>>> www.aboutfortunate.com
>>>>>
>>>>> "Out of chaos comes order."
>>>>> Nietzsche
>>>>> "J-T" <J-*@nospam.com> wrote in message
>>>>> news:ew**************@TK2MSFTNGP11.phx.gbl...
>>>>>> Thanks for the reply.
>>>>>>
>>>>>> I used the way that you suggested ,but the problem is that it is
>>>>>> returing relative path to the picture which is in the page and
>>>>>> because that picture dosen;t exist in my website ,the picture is
>>>>>> not showig up well.Page contains a relative path to the picture
>>>>>> and page is not part of my website,I am getting its content from
>>>>>> a website to which I have to access.When I use iframe the whole
>>>>>> page is rendered and then I don;t care about the paths in the
>>>>>> page.
>>>>>>
>>>>>> Any suggesions?
>>>>>>
>>>>>> Thanks agian
>>>>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com>
>>>>>> wrote in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>>>>>>> Another possibility would be to use a web request and a literal
>>>>>>> control. This is the method I prefer because you can check if
>>>>>>> the request is valid and handle the possibility of the page
>>>>>>> you're requesting not showing up...
>>>>>>>
>>>>>>> Something along these lines:
>>>>>>>
>>>>>>> '---Create the request
>>>>>>>
>>>>>>> Dim WebRequest As System.Net.WebRequest =
>>>>>>> System.Net.WebRequest.Create(New
>>>>>>> Uri(CurrentLink))
>>>>>>>
>>>>>>> WebRequest.Timeout = 2000
>>>>>>>
>>>>>>> '---Get the response produced by the request
>>>>>>>
>>>>>>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>>>>>>
>>>>>>> '---Download the page content into a stream
>>>>>>>
>>>>>>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>>>>>>
>>>>>>> '---Place the stream into a stream reader
>>>>>>>
>>>>>>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>>>>>>
>>>>>>> '---Read the stream into a string object
>>>>>>>
>>>>>>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>>>>>>
>>>>>>> '---Place the string into a literal control
>>>>>>>
>>>>>>> Literal1.Text = HtmlReceived
>>>>>>>
>>>>>>> '---Cleanup
>>>>>>>
>>>>>>> Stream.Close()
>>>>>>>
>>>>>>> StreamReader.Close()
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Sincerely,
>>>>>>>
>>>>>>> S. Justin Gengo, MCP
>>>>>>> Web Developer / Programmer
>>>>>>>
>>>>>>> www.aboutfortunate.com
>>>>>>>
>>>>>>> "Out of chaos comes order."
>>>>>>> Nietzsche
>>>>>>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>>>>>>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>>>>>>> Yep! <iframe> will do.
>>>>>>>>
>>>>>>>> <iframe
>>>>>>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>>>>>>
>>>>>>>>
>>>>>>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>>>>>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>>>>>>> I'd try an <iframe> element.
>>>>>>>>>
>>>>>>>>> HTH,
>>>>>>>>> Axel Dahmen
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------
>>>>>>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>>>>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>>>>>>> Hi All,
>>>>>>>>>>
>>>>>>>>>> There is a picture on the following URL which I want to have
>>>>>>>>>> it in one of
>>>>>>>>>> my asp.net pages .I mean I want to embed the content of this
>>>>>>>>>> page in my
>>>>>>>>> own
>>>>>>>>>> page and get its image.Is there a control or tecnique which
>>>>>>>>>> I can
>>>>>>>>>> accomplish this?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>>>>>>
>>>>>>>>>> Thanks a lot
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #18
J-T,

You're Welcome. Anytime!

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <Re**@Reza.Com> wrote in message
news:eg**************@TK2MSFTNGP10.phx.gbl...
Thanks for all the nice help
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
J-T,

Sorry about the stream name mixup...

Yes, this solution would still be viable. For example you coud right a
Select Case statement that would pick which url to grab based on
querystring input...
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Justine,

I guess my other question is that if I want to get 4 of these pitures at
four differnet URLs ,is the solution still applicable?

Thanks
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote in
message news:eJ****************@TK2MSFTNGP09.phx.gbl...
J-T,

Actually, it's even easier than that...

You don't even need the page I created at all, unless you want to
double check that the image is available.

If you don't care if it doesn't show up every now and then you could
just set your image url directly to it.

again I'd tag on random numbers to the query string to stop caching...

http://www.tehrantraffic.com/cam3_ttcc_00001.jpg?id=2

But if you do want to check whether the image is being delivered or not
then the GetBuffer method is available from C# also...

Try it out:

Response.Clear;

Response.ContentType = "image/gif";
System.Net.WebRequest ImageWebRequest;

ImageWebRequest = System.Net.WebRequest.Create(New
Uri("http://www.tehrantraffic.com/cam3_ttcc_00001.jpg"));

System.Net.WebResponse WebResponse = ImageWebRequest.GetResponse;

System.IO.MemoryStream MemoryStream = Response.GetResponseStream;
MemoryStream.GetBuffer();
Response.BinaryWrite(MemoryStream.GetBuffer);
MemoryStream.Close();

MemoryStream = Nothing;

Oh, and i think I know why you don't see the GetBuffer method... You
are probably not seeing quite a few interesting methods...

In Visual Studio go to the menu and click Tools - Options.

In the window that opens Click the "Text Editor" folder in the left
hand pane. Then Click the "C#" folder.

In the Right hand pane uncheck the "Hide Advance Members" checkbox.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"J-T" <J-*@nospam.com> wrote in message
news:Ou**************@TK2MSFTNGP09.phx.gbl...
> That's cool.I didn;t know that I can have access to that image
> directly through the url.You probably found it from its relative path
> .I didn;t notice that .Good point .
>
> Now that I have the url of the picture ,rather than the url of the
> hosting page ,I guess it is easier to follow.The only question is this
> line of code:
> Response.BinaryWrite(MemoryStream.GetBuffer)
> I am using C# and MemoryStream of type System.IO.Stream dosesn;t give
> me the GetBuffer method? How can I get that method?
>
> I so appreciate your help
>
>
> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
> in message news:e8**************@tk2msftngp13.phx.gbl...
>> Oh, and change the content type in the code from jpg to gif.
>>
>> --
>> Sincerely,
>>
>> S. Justin Gengo, MCP
>> Web Developer / Programmer
>>
>> www.aboutfortunate.com
>>
>> "Out of chaos comes order."
>> Nietzsche
>> "J-T" <J-*@nospam.com> wrote in message
>> news:u9***************@tk2msftngp13.phx.gbl...
>>> Sorry,I guessed I am misleading you by bad explanation.
>>>
>>> The source is a page that contains the image :
>>>
>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>
>>> page gif.asp ultimately contians this picture :cam3_ttcc_00001.jpg
>>> !The picture is being updated every 2 minues and that's why I need
>>> to update my hosting user control in 2 minutes as well to show
>>> latest picture.I have no access to the image so any relative path to
>>> the image dosen;t work,the only thing I have access to is the URL I
>>> mentioned above.
>>>
>>> Thanks a lot for the help
>>>
>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com> wrote
>>> in message news:eU**************@TK2MSFTNGP12.phx.gbl...
>>>> In that case you could create a .aspx page that sends the image to
>>>> you using the response object.
>>>>
>>>> You would then set the link of your image to the imagedelivery.aspx
>>>> page.
>>>>
>>>> The code for the delivery page would be like this:
>>>>
>>>> '------------------------------------------------------------------------------------------
>>>> 'Sub: Page_Load DateCreated:8/26/2005 By: S. Justin Gengo
>>>> DateModified: By:
>>>> '
>>>> ' Comments:
>>>> ' Delivers an image from the image table stored in memory as
>>>> a stream.
>>>> '------------------------------------------------------------------------------------------
>>>> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
>>>> System.EventArgs) Handles MyBase.Load
>>>> Dim MemoryStream As System.IO.Stream
>>>> Try
>>>> Response.Clear()
>>>> Response.ContentType = "image/jpeg"
>>>>
>>>> Dim ImageWebRequest As System.Net.WebRequest
>>>>
>>>> ImageWebRequest = System.Net.WebRequest.Create(New
>>>> Uri("http://www.mywebapp/uri of image here.jpg"))
>>>> ImageWebRequest.Timeout = 2000
>>>>
>>>> '---Get the response produced by the request
>>>> Dim Response As System.Net.WebResponse =
>>>> ImageWebRequest.GetResponse
>>>>
>>>> '---Download the page content into a stream
>>>> MemoryStream = Response.GetResponseStream
>>>>
>>>> Response.BinaryWrite(MemoryStream.GetBuffer)
>>>> Catch ex As Exception
>>>> '---Handle any errors here.
>>>> Finally
>>>> If Not MemoryStream Is Nothing Then
>>>> MemoryStream.Close()
>>>> MemoryStream = Nothing
>>>> End If
>>>> End Try
>>>> End Sub
>>>>
>>>>
>>>> Then set your link to the image delivery page. You could even tack
>>>> on a random number as a querystring id to the default page's url
>>>> each page load something like:
>>>>
>>>> Image1.ImageUrl = "http://www.mywebapp.com/imagedelivery.aspx?id="
>>>> & Rnd.ToString & Rnd.ToString
>>>>
>>>> The query string will make the client browser think that the image
>>>> url has changed every page load. Thus, no caching of images.
>>>>
>>>> --
>>>> Sincerely,
>>>>
>>>> S. Justin Gengo, MCP
>>>> Web Developer / Programmer
>>>>
>>>> www.aboutfortunate.com
>>>>
>>>> "Out of chaos comes order."
>>>> Nietzsche
>>>> "J-T" <J-*@nospam.com> wrote in message
>>>> news:eD*************@tk2msftngp13.phx.gbl...
>>>>>
>>>>> Always same picture.URL never gets changed!!!
>>>>>
>>>>> Thanks
>>>>>
>>>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com>
>>>>> wrote in message news:eD*************@TK2MSFTNGP11.phx.gbl...
>>>>>> J-T,
>>>>>>
>>>>>> Is it always the same picture you're after? Or will the url
>>>>>> change?
>>>>>>
>>>>>> --
>>>>>> Sincerely,
>>>>>>
>>>>>> S. Justin Gengo, MCP
>>>>>> Web Developer / Programmer
>>>>>>
>>>>>> www.aboutfortunate.com
>>>>>>
>>>>>> "Out of chaos comes order."
>>>>>> Nietzsche
>>>>>> "J-T" <J-*@nospam.com> wrote in message
>>>>>> news:ew**************@TK2MSFTNGP11.phx.gbl...
>>>>>>> Thanks for the reply.
>>>>>>>
>>>>>>> I used the way that you suggested ,but the problem is that it is
>>>>>>> returing relative path to the picture which is in the page and
>>>>>>> because that picture dosen;t exist in my website ,the picture is
>>>>>>> not showig up well.Page contains a relative path to the picture
>>>>>>> and page is not part of my website,I am getting its content from
>>>>>>> a website to which I have to access.When I use iframe the whole
>>>>>>> page is rendered and then I don;t care about the paths in the
>>>>>>> page.
>>>>>>>
>>>>>>> Any suggesions?
>>>>>>>
>>>>>>> Thanks agian
>>>>>>> "S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com>
>>>>>>> wrote in message news:uF**************@TK2MSFTNGP14.phx.gbl...
>>>>>>>> Another possibility would be to use a web request and a literal
>>>>>>>> control. This is the method I prefer because you can check if
>>>>>>>> the request is valid and handle the possibility of the page
>>>>>>>> you're requesting not showing up...
>>>>>>>>
>>>>>>>> Something along these lines:
>>>>>>>>
>>>>>>>> '---Create the request
>>>>>>>>
>>>>>>>> Dim WebRequest As System.Net.WebRequest =
>>>>>>>> System.Net.WebRequest.Create(New
>>>>>>>> Uri(CurrentLink))
>>>>>>>>
>>>>>>>> WebRequest.Timeout = 2000
>>>>>>>>
>>>>>>>> '---Get the response produced by the request
>>>>>>>>
>>>>>>>> Dim Response As System.Net.WebResponse = WebRequest.GetResponse
>>>>>>>>
>>>>>>>> '---Download the page content into a stream
>>>>>>>>
>>>>>>>> Dim Stream As System.IO.Stream = Response.GetResponseStream
>>>>>>>>
>>>>>>>> '---Place the stream into a stream reader
>>>>>>>>
>>>>>>>> Dim StreamReader As New System.IO.StreamReader(Stream)
>>>>>>>>
>>>>>>>> '---Read the stream into a string object
>>>>>>>>
>>>>>>>> Dim HtmlReceived As String = StreamReader.ReadToEnd
>>>>>>>>
>>>>>>>> '---Place the string into a literal control
>>>>>>>>
>>>>>>>> Literal1.Text = HtmlReceived
>>>>>>>>
>>>>>>>> '---Cleanup
>>>>>>>>
>>>>>>>> Stream.Close()
>>>>>>>>
>>>>>>>> StreamReader.Close()
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Sincerely,
>>>>>>>>
>>>>>>>> S. Justin Gengo, MCP
>>>>>>>> Web Developer / Programmer
>>>>>>>>
>>>>>>>> www.aboutfortunate.com
>>>>>>>>
>>>>>>>> "Out of chaos comes order."
>>>>>>>> Nietzsche
>>>>>>>> "Onin Tayson" <Le*********@compaid.com> wrote in message
>>>>>>>> news:%2****************@TK2MSFTNGP10.phx.gbl...
>>>>>>>>> Yep! <iframe> will do.
>>>>>>>>>
>>>>>>>>> <iframe
>>>>>>>>> src="http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC%20website"></iframe>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> "Axel Dahmen" <NO*****@NoOneKnows.invalid> wrote in message
>>>>>>>>> news:Ot**************@TK2MSFTNGP12.phx.gbl...
>>>>>>>>>> I'd try an <iframe> element.
>>>>>>>>>>
>>>>>>>>>> HTH,
>>>>>>>>>> Axel Dahmen
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ------------------
>>>>>>>>>> "J-T" <Re**@Reza.Com> schrieb im Newsbeitrag
>>>>>>>>>> news:eH**************@tk2msftngp13.phx.gbl...
>>>>>>>>>>> Hi All,
>>>>>>>>>>>
>>>>>>>>>>> There is a picture on the following URL which I want to have
>>>>>>>>>>> it in one of
>>>>>>>>>>> my asp.net pages .I mean I want to embed the content of this
>>>>>>>>>>> page in my
>>>>>>>>>> own
>>>>>>>>>>> page and get its image.Is there a control or tecnique which
>>>>>>>>>>> I can
>>>>>>>>>>> accomplish this?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> http://www.tehrantraffic.com/gif.asp...TTCC%20website
>>>>>>>>>>>
>>>>>>>>>>> Thanks a lot
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Nov 19 '05 #19

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

Similar topics

4
2757
by: Alicia Haumann | last post by:
I accidentally sent this to webmaster@python.org, so this could be a duplicate if "webmaster" forwards it to this list. :{ Hi, there. Thanks for any help that can be offered. I've been...
5
611
by: Victor Fees | last post by:
I have an XML string in a database that I would like to display using XSLT. All of that works like a champ, but I can't figure out how to embed the XML inside an ASPX page. For example, I have...
4
3289
by: FC | last post by:
Hello folks, I was wondering if there any other method of achieving the following: I have a XSL transformation outputting a SVG document. For reasons too long to explain here, I must embed a CSS...
56
6852
by: alan b | last post by:
I copied it and tried to edit the movie.htm below in the <PARAM NAME=*** location of the file where the videoclip is on my hard drive. It is already recorded by Windows Media Player. My version...
8
1766
by: Alan Lue | last post by:
Hi, I'm trying to set up a webpage so that I can view multiple HTML files from the same page. For example, you might go to http://example.com/lab_tests.html and be able to view lab1.html,...
5
4089
by: John | last post by:
I have a number of self-composed songs in mp3 format which are linked to their individual titles with <a href... The problem with this coding is that the songs open in a new window containing the...
3
13642
by: Ollie Riches | last post by:
How do I embed a *.flv file (Flash Video) into an aspx page similar to embedding windows media player active x control? Cheers Ollie Riches
4
5658
by: David Abrahams | last post by:
I'm seeing highly surprising (and different!) behaviors of PyImport_ImportModule on Linux and Windows when used in a program with python embedding. On Linux, when attempting to import a module...
0
1162
polymorphic
by: polymorphic | last post by:
I have a client with a large pdf catalog. The client's web site is using classic asp. The catalog is taking too long to load for users so we had decided to load one pdf page at a time via a...
5
3395
by: Anil Gupte | last post by:
How do I embed Windows Media Player so I can control it with VB code. I am familiar with embedding in a web page like this: *************** <embed src="Test.asx" width=320 height=300...
0
7136
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
7182
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
7232
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
7397
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...
0
5490
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
3110
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...
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
672
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.