Images are not getting displayed when using HTTPHandler

G

Guest

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.
 
B

Brock Allen

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.
 
G

Guest

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top