Finally got the culprit. It's me, :)
finally
{
if (myresponse != null) myresponse.Close();
}
Default.aspx.cs
<code>
[System.Web.Services.WebMethod]
public static string GetData(string IO)
{
string str, url;
url = 'http://www.samplesite/images/'+IO+'gif';
try
{
System.Net.HttpWebRequest webrequest = (System.Net.HttpWebRequest) System.Net.HttpWebRequest.Create(url);
System.Net.HttpWebResponse myresponse = (System.Net.HttpWebResponse)webrequest.GetResponse();
if(myresponse.StatusCode==System.Net.HttpStatusCode.OK)
str = "True";
else
str = "False";
}
catch (Exception e)
{
if (e.Message.Contains("404"))
str = "False";
else
str = "Error";
}
finally
{
if (myresponse != null) myresponse.Close();
}
return (IO + "`" + str);
}
</code>
I have not closed my HttpWebResponse in my web method, which made this confusion. Pagemethod doenot have nothing to do here. Sorry for miss lead this issue. Learned a lesson "Approach the issue in all possible ways" and not in a single minded. Thanks to Sandeep and Abhinav.