How to know if the request is ajax in asp.net in Application_Error()
I want to handle app error in Application_Error().If the request is ajax and some exception is thrown,then write the error in log file and return a json data that contains error tips for client . Else if the request is synchronism and some exception is thrown ,write the error in log file and then redirect to a error page.
but now i cant judge which kind the request is . I want to get "X-Requested-With" from header ,unfortunately keys of headers don't contain "X-Requested-With" key ,why?