C# Error

Status
Not open for further replies.

Krish

User is banned.
Reputation
0
Closed thread, @Coder's helping me get it resolved, thanks
 
Change.. "NotFound" to "ProtocolError".

Let me know if that works.
 
Coder said:
Change.. "NotFound" to "ProtocolError".

Let me know if that works.

Just changed and it added another error.
 
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)
 
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)

Just tried, response doesn't have the definition for .StatusCode, when i try just response, it can't be applied to opperands of type 'System.Net.WebResponse' and 'System.Net.HttpStatusCode'
 
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);
}
}
 
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 = ("Fk Is Beast: " + all.SelectedItem);
}
 
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)
 
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)

I'll PM you what I got so far as far as my Checking Method.
 
Krish said:
I'll PM you what I got so far as far as my Checking Method.

Alright, I'll see if I can help you get the listbox issue working. 
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…