Coder said:Change.. "NotFound" to "ProtocolError".
Let me know if that works.
EGLZ said:I don't use C# so I may be wrong but wouldn't you want to be calling the status code on your response variable?
so if (response.StatusCode == HttpStatusCode.NotFound)
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
//Console.WriteLine(responseFromServer);
reader.Close();
response.Close();
try
{
response = request.GetResponse() as HttpWebResponse;
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError)
{
Available.Items.Add(all.SelectedIndex);
st.Text = ("Fk Is Beast: " + all.SelectedItem);
}
}
NICE! It works but doesn't move the item into the listbox at the end, this bit doesn't work and i haven't gotten it to work yet:Coder said:Try this.. don't hold me to it though. I had to use a converter as I don't know C# that well. I feel like this will work though.
Code:WebResponse response = request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); //Console.WriteLine(responseFromServer); reader.Close(); response.Close(); try { response = request.GetResponse() as HttpWebResponse; } catch (WebException ex) { if (ex.Status == WebExceptionStatus.ProtocolError) { Available.Items.Add(all.SelectedIndex); st.Text = ("Fk Is Beast: " + all.SelectedItem); } }
if (ex.Status != WebExceptionStatus.ProtocolError)
{
Available.Items.Add(all.SelectedItem);
st.Text = ("Fk Is Beast: " + all.SelectedItem);
}
Can you give some more detail on how your looping function works?Krish said:NICE! It works but doesn't move the item into the listbox at the end, this bit doesn't work and i haven't gotten it to work yet:
Code:if (ex.Status != WebExceptionStatus.ProtocolError) { Available.Items.Add(all.SelectedItem); st.Text = ("Checker: " + all.SelectedItem); }
Coder said:Can you give some more detail on how your looping function works?
Are you using a for each loop? Can you show a the beginning part of your code? (you can censor out the API/URL if you want)
Krish said:I'll PM you what I got so far as far as my Checking Method.