Last post Apr 29, 2015 11:01 PM by Krunal Parekh
Apr 28, 2015 08:15 AM|mandrews1234|LINK
I'm trying to beef up my error reporting. Right now, I just have some code to log stuff in the global asax on application error, and then redirect to an error page. I'm wondering if there's a way to get all of the post data? Basically now I get the error
message and url, but I'd like to see what actual post data was being sent as sometimes it's not enough for me to troubleshoot the error, just having the error message. This is what I'm doing so far.
Dim ex = Server.GetLastError
Dim errStr = ""
While ex IsNot Nothing
errStr &= ex.Message & "<br /><br />"
errStr &= ex.Source & "<br /><br />"
errStr &= ex.StackTrace & "<br /><br />"
errStr &= Environment.StackTrace & "<br /><br /><hr />"
ex = ex.InnerException
And then I log that errStr. How would I go about getting the post data too?
Apr 28, 2015 10:20 AM|Rajat|LINK
check Innerexception & Stack trace null condition then add it.
if (ex.InnerException != null)
For more detail please review
Apr 29, 2015 11:01 PM|Krunal Parekh|LINK
1. First of all I would recommend this article by
ASP.NET Error Handling. It provides best practices for the error handling.
2. I would also recommend you could log errors from IIS. it will all the request and response errors.
3. if you want to log post data also you could create an extension method where it accepts the post data by the request and log it manually. then you can pass it to your log method where ever you fill that you should also log the post data.
Hope this helps.