locked
How to get system error message in vb page? RRS feed

  • Question

  • User546194788 posted

    In web.config I used code below to disable custom errors.

    <customErrors mode="Off" />

    To view errors for debug, I need to call IT to get errors in web server in event viewer.

    If I add code below in web.config which only displays warning message.

    <customErrors mode="RemoteOnly" defaultRedirect="~/GeneralErrorPage.htm" />

    Is there any way to code in vb page to list real error for debug?

    Tuesday, February 26, 2019 12:32 PM

All replies

  • User753101303 posted

    Hi,

    It would be shown to the user having the error which won't really help. This is your own IT people ? They might be able to send a daily summary or an alert when an event with a given sourceis written to the log.

    Else exceptions are processed based on https://www.codeproject.com/Articles/420540/ASP-NET-Health-Monitoring or you could use https://elmah.github.io/ and manage them as best fit such as sending them by mail or storing them to files or to a db with possibly a reminder to check past errors and have something built in the app to check for them ?

    Tuesday, February 26, 2019 1:13 PM
  • User-893317190 posted

    Hi aspfun,

    Have you tried  

      <system.webServer>
        <httpErrors errorMode="Detailed" existingResponse="PassThrough"></httpErrors>

    This configuration will also effect the exception output to client.

    Please refer to https://stackoverflow.com/questions/11665322/how-to-set-web-config-file-to-show-full-error-message

    For detailed guide , you could also refer to  https://weblog.west-wind.com/posts/2017/jun/01/bypassing-iis-error-messages-in-aspnet

    But please pay attention that  if your want  your server to return full exception message to client, any other client that could visit your server will also get the detailed message.

    Best regards,

    Ackerly Xu

    Wednesday, February 27, 2019 3:00 AM
  • User546194788 posted

    I don't want to return full exception message to client.

    Is it possible to send an email to someone with full exception message?

    In winform project, I can use "try catch" to do it.

    Thursday, February 28, 2019 2:10 PM
  • User465171450 posted

    Definitely, but what you want to do is look for some sort of logging. Try/Catch is great, but depending on what you do in the catch you can create more problems if it's too intrusive.

    Take a look at Elmah. https://elmah.github.io/

    It's able to capture uncaught errors. It can log them to a file, send them in an email, and other operations.

    Thursday, February 28, 2019 6:20 PM