T
TomislaW
I need to include some pictures from other web application (written in
Java), Source of pictures are: <http://www.xy.com/bla/id/imageNumber>. I
don't know how many pictures there are So I need to read header from
WebRequest to see if it is default image or not This is my code:
int i = 0;
bool defaultImage = true;
do
{
i++;
WebRequest myWebRequest = WebRequest.Create("http://www.xy.com/bla/id/" +
i.ToString());
WebResponse myWebResponse = myWebRequest.GetResponse();
defaultImage = bool.Parse(myWebResponse.Headers["DEFAULTIMAGEUSED"]);
myWebResponse.Close();
if(!defaultImage)
Response.Write("<img src='" + myWebResponse.ResponseUri.AbsoluteUri +"'>");
}while(!defaultImage);
this is very slow and I think that my web application doing two requests for
one picture (
once when I make WebRequest in code and once when I set src of img tag in
html)
, is there any better solution?
Java), Source of pictures are: <http://www.xy.com/bla/id/imageNumber>. I
don't know how many pictures there are So I need to read header from
WebRequest to see if it is default image or not This is my code:
int i = 0;
bool defaultImage = true;
do
{
i++;
WebRequest myWebRequest = WebRequest.Create("http://www.xy.com/bla/id/" +
i.ToString());
WebResponse myWebResponse = myWebRequest.GetResponse();
defaultImage = bool.Parse(myWebResponse.Headers["DEFAULTIMAGEUSED"]);
myWebResponse.Close();
if(!defaultImage)
Response.Write("<img src='" + myWebResponse.ResponseUri.AbsoluteUri +"'>");
}while(!defaultImage);
this is very slow and I think that my web application doing two requests for
one picture (
once when I make WebRequest in code and once when I set src of img tag in
html)
, is there any better solution?