Loading website in webhost, webconfig Runtime Error
I finished my website and uploaded it to my web host, but I get this error when trying to access the site (alternative here: clematistest.web.surftown.dk ):
Runtime error: An application error has occurred on the server. The current custom error settings for this app are preventing the app error details from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on a local server.
Details. To include information about this particular error message for viewing on remote machines, please create a tag within the "web.config" configuration file located in the root directory of the current web application. This tag must have its "mode" attribute set to "Off".
<! - Configuration File Web.Config →
<configuration> <system.web> <customErrors mode = "Off" / "> </system.web> </configuration>
Notes: The current error page vision can be overridden with the normal error page by changing the defaultRedirect attribute for the application <customErrors> configuration tag to point to a custom error page URL.
<! - Configuration File Web.Config →
<configuration> <system.web> <customErrors mode = "RemoteOnly" defaultRedirect = "mycustompage.htm" / "> </system.web> </configuration>
I tried to insert the config file, but I am getting the same error.
What should I do to fix this?
/Thank
source to share
This usually happens when an unhandled exception is thrown in your code.
See how the web.config setup issues arise so that the website displays a remote error and a stack trace,
you could add TRY and CATCH blocks around the parts of your code where you suspect an exception might be thrown ... Then in the catch you can do a redirect to the general simple error page where you can display the exception message.
Edit: you can also redirect to the custom error page from the on error event in the global.
source to share
As you can see from the error message, you can completely disable your own sorting errors.
In your web.config look for "customErrors" - if you have a standard version of the file this will be fully commented out - remove comments and change the custom error mode from "RemoteOnly" to "Off"
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
If there is no customErrors block, just add it between the <system.web> tags.
When finished, set it to "RemoteOnly" or "On" and add at least the default Redirect to indicate a friendly error message for your users.
The full error message will then be displayed, and if you have a debug construct deployed (or you are using a website and you have configured the compile mode for debugging, not a compiled web application), you will also get line numbers, etc. not bias.
Once you solve the problem, I recommend following Roberto Sebestyen's guidelines and adding proper error handling and reporting to your site;)
source to share