Groups | Blog | Home
all groups > asp.net > april 2005 >

asp.net : Images are not getting displayed when using HTTPHandler


Hitesh
4/21/2005 10:52:02 PM
Hi,

I am getting the response from another Website by using the HttpHandler in
my current site. I am getting the page but all the images on that page are
not appearing only placeholder are displayed.

Can anybody know this issue and help me to resolve this.
--
Thanks
Brock Allen
4/22/2005 2:36:41 AM
Open the rendered HTML, look for the <img> tags and it should be obvious.
<img> tags require another request to the server to fetch the image at the
URL specified in the src attribute. So in your handler, you'll need to parse
the HTML you're getting back, find the <img> tags, make another request to
get those, change the src rendered from your handler to come back into you,
then dynamically serve up the bits of those images. This assumes the images
aren't available at the original URLs, but it doesn't sound like they are.

-Brock
DevelopMentor
http://staff.develop.com/ballen



[quoted text, click to view]


Hitesh
4/24/2005 9:49:01 PM
Hi Brock,

Thanks for your suggestion and i have done the task in one more way let me
discuss that with you and confirm that it will work always:

See what i have done is while parsing the response i have replaced the src
attribute of all the img tags by appending the "http:// + remote host name"
to them and now its rendering the image also.

So what do you think is this ok or it has some drawbacks in it ?

and if you find anything wrong with it then it would be very helpful if you
can give me some sample code of your approach, i am really wondering how
should i write the code to get the images only once again and merge the two
responses together?

Thanks!

[quoted text, click to view]
AddThis Social Bookmark Button