Asked by:
When using IHttpNegotiate and the server returns HTTP response 204 OnResponse is not called

Question
-
Hi all,
As the title says when i am using IHttpNegotiate and the server returns HTTP response 204 OnResponse is not called. instead OnStopBinding is called with a generic error code. How can i tell the response was 204 in this scenario?
Thanks in advance,
Omer.
All replies
-
Hi Omer Balash,
Do you mean your getting an error and you want to handle it?
Did you try to use Try..catch statement in your code to handle the errors in your code?
If not you can use it to catch that error and perform the desired steps after error get occurred.
Example of Try..Catch..Finally:
public class EHClass { void ReadFile(int index) { // To run this code, substitute a valid path from your local machine string path = @"c:\users\public\test.txt"; System.IO.StreamReader file = new System.IO.StreamReader(path); char[] buffer = new char[10]; try { file.ReadBlock(buffer, index, buffer.Length); } catch (System.IO.IOException e) { Console.WriteLine("Error reading from {0}. Message = {1}", path, e.Message); } finally { if (file != null) { file.Close(); } } // Do something with buffer... } }
Reference:
try-catch-finally (C# Reference)
Let us know, if I misunderstand something from your above description as only 1 line of description is not enough for understanding the issue properly.
If possible than you can try to provide a sample code with detailed steps to reproduce the issue on our end.
We will try to test the issue to check the results.
Thanks for your understanding.
Regards,
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com. -
Hi Deepak,
No, no exception is being thrown. The onResponse method is simply not being called on my IHTTPNegotiate object (for other HTTP response types it is getting called successfully). OnStopBinding from IBindStatusCallback is being called in this case signaling the transaction was aborted (this is however *not* the case as confirmed by fiddler).
Thanks,
Omer.
-
Hi Omer Balash,
You provided only description about the issue without any sample code.
We don't know what exactly you are doing in your code.
If we assume and make a test than also it can be differ from the actual code and not produce the issue.
If possible for you than please try to provide a sample code to test on our side with detailed steps.
It can help us to understand the issue in better way.
Thanks for your understanding.
Regards,
Deepak
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.