1

I have simple aspx code. When I run the aspx page with local server(Visual Studio Development Server) all works fine. But when I run it on my domain I get the following exception.

Description: 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.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

aspx code:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h1>I am online</h1>
    </div>
    </form>
</body>
</html>

1 Answer 1

0

Change to this in ypur web.config and you will get the exception. You could also browse the website from the same domain as the application and would then also see the exception.

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>
Sign up to request clarification or add additional context in comments.

4 Comments

@TheChampp Did you restart IIS after the change? Can you connect to the server your site is located on and browse it from there?
Sometimes if it doesn't work and you see this error even after you've set the mode to Off -- it is because there is a syntax error in the web.config itself (i.e. malformed XML).
@mikey shouldn't a syntax error show itself on the development machine? In the question it says there is an error when deployed.
@Magnus it depends. Usually configuration settings are different for different environments. For example if I update the web.config on the production server to reflect a production database connection string and accidentally forget to close a tag, or close an attribute quotation mark, or put characters that need escaping in an attribute -- BAM! All of the above have happened to me.. I sometimes check it (with more recent versions of IIS) by trying to open a configuration page for the site with IIS manager (e.g. .NET Roles) -- if it fails then I know it is a syntax error with the XML.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.