Image request after page request - WeOnlyDo Discussion board

Image request after page request (General questions)

by dirk, Wednesday, October 19, 2011, 12:43 (4595 days ago)

In my code the webserver component serves a webpage and this is done based on the user.response.filename
If within the file it's serving there is an image, then the browser will do a new request to the webserver using the name of the image.
Within that last request (for the image), can I still know what the original page was that was requested?
Also within the actual request for the image, can I see that it's an image? (or can I only know this by checking the extension on the URI?)

Re: Image request after page request

by wodDamir, Wednesday, October 19, 2011, 13:07 (4595 days ago) @ dirk

Dirk,

Unfortunately, the answer to both these questions would be no. In case of the first question, a client creates a completely new request.

The only thing you could peobably do is keep track of each request, and distinguish them based on some properties (i.e. IP address, username or password, session variable). You could in that case keep track of the requests server-side.

As for the second question, a client simply tells server the document he wants to retrieve. Server is the one that actually tells him what type of content is being sent (sets Content-type header).

Hope this helps.

Regards,
Damba

Re: Image request after page request

by dirk, Wednesday, October 19, 2011, 14:08 (4595 days ago) @ wodDamir

OK I'll have to find a way to get this to work the way I want it :-)