How to catch a specific HttpException (# 0x80072746) in IHttpHandler

It seems that this HttpException (0x80072746 - the remote host has closed the connection) can be triggered if, for example, the user closes the window while we transfer the file. Even if we send files in smaller blocks and check that the client is still connected, an exception can still occur. We want to catch this particular exception in order to ignore it.

The errorcode provided in the HttpException is Int32 - too small to hold 0x80072746, so where do we find this number?

+3
source share
3 answers

Int32 0x80072746; "" : 0x80072746 == -2147014842, , :

const int ErrConnReset = unchecked((int)0x80072746);

const int ErrConnReset = -2147014842;
+5

HttpException.ErrorCode , . :

        try {
            //...
        }
        catch (HttpException ex) {
            if ((uint)ex.ErrorCode != 0x80072746) throw;
        }
+5

, 1 (: wikipediat).

0x80072746 2:

1000 0000 0000 0111 0010 0111 0100 0110

... :

-0111 1111 1111 1000 1101 1000 1011 1010

, , 10 :

-2147014842

, , .

, .

+2

Source: https://habr.com/ru/post/1794428/


All Articles