c# - No InnerException in global HttpModule for ASMX Services -


i implemented ihttpmodule our asmx-services suggested in https://stackoverflow.com/a/551532/6607492

unfortunately serialized exception (which in json-format in our case) not contain information innerexception.

is there way see innerexception also?

my code ist similar has been given in answer mentioned above:

public class globalerrorlogmodule : ihttpmodule {     private ilogger log = logger.getlogger();     private errorhandlerfilter errorhandlerfilter = null;      public void init(httpapplication context)     {         context.postrequesthandlerexecute += context_postrequesthandlerexecute;         context.endrequest += context_endrequest;     }      private void context_postrequesthandlerexecute(object sender, eventargs e)     {         httpapplication app = (httpapplication)sender;         if (app.response.statuscode == 500)         {             errorhandlerfilter = new errorhandlerfilter(app.response.filter);             app.response.filter = errorhandlerfilter;         }     }      private void context_endrequest(object sender, eventargs e)     {         httpapplication app = (httpapplication)sender;         if (app.response.statuscode == 500)         {             string exceptioncontent = "";             if (errorhandlerfilter != null)             {                 exceptioncontent = encoding.utf8.getstring(errorhandlerfilter.writtenbytes.toarray());                 errorhandlerfilter = null;             }              //the exceptioncontent in json-format , not contain information abouth innerexception             log.error(exceptioncontent);         }     }      public void dispose()     {     } }  public class errorhandlerfilter : stream {     private readonly stream responsefilter;      public list<byte> writtenbytes { get; private set; }      public errorhandlerfilter(stream responsefilter)     {         this.responsefilter = responsefilter;         writtenbytes = new list<byte>();     }      public override void write(byte[] buffer, int offset, int count)     {         (int = offset; < offset + count; i++)         {             writtenbytes.add(buffer[i]);         }         responsefilter.write(buffer, offset, count);     }      public override void flush()     {         responsefilter.flush();     }      public override long seek(long offset, seekorigin origin)     {         return responsefilter.seek(offset, origin);     }      public override void setlength(long value)     {         responsefilter.setlength(value);     }      public override int read(byte[] buffer, int offset, int count)     {         return responsefilter.read(buffer, offset, count);     }      public override bool canread     {         { return responsefilter.canread; }     }      public override bool canseek     {         { return responsefilter.canseek; }     }      public override bool canwrite     {         { return responsefilter.canwrite; }     }      public override long length     {         { return responsefilter.length; }     }      public override long position     {         { return responsefilter.position; }         set { responsefilter.position = value; }     } } 


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -