skip to Main Content

I am trying to run the program which is an ASP.Net C# program.

However I get this error:

An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

I have checked the web.config file Line 37 which looks okay.

Can anyone please guide me on what the issue is

<compiler language="c#;cs;csharp" extension=".cs"
          type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
          type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
          warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+"/>

2

Answers


  1. To enable/disable seeing custom errors on your localhost and remote clients, you need to set the following key in web.config in your case:

    <customErrors mode="Off">
    

    Will show the detailed ASP.NET errors to the remote clients and to the local host.

    You can read more about this element here

    Login or Signup to reply.
  2. Also, depending on the .net version you could use this to catch errors (in Global.asax.cs file):

    protected void Application_Error(object sender, EventArgs e)
            {
                try
                {
                    Exception ex = new Exception();
                    ex = Server.GetLastError();
                    if (ex.Message.Contains("NoCatch") || ex.Message.Contains("maxUrlLength"))
                    {
                        //log message code here
                        return;
                    }
                }
                catch (Exception)
                {
                    
                }
            }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search