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
message 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
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
in message 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
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?g=cam3_ttcc_00001.jpg&t=TTCC website
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
in message 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
Always same picture.URL never gets changed!!!
Thanks
"S. Justin Gengo" <sjgengo@[no_spam_please]aboutfortunate.com>
wrote in message 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
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 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
Yep! <iframe> will do.
<iframe
src="
http://www.tehrantraffic.com/gif.asp?g=cam3_ttcc_00001.jpg&t=TTCC website"></iframe>
I'd try an <iframe> element.
HTH,
Axel Dahmen
------------------
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?g=cam3_ttcc_00001.jpg&t=TTCC website
Thanks a lot