0

I've followed the below tutorial to retrieve data from a SQL Server database hosted on 1&1, but I'm getting a runtime error.

Connect to a SQL Server database using ASP.NET

I copied the code and changed the credentials to match a very simple database table I created to test it. I saved the file as an aspx file but when I try and reach the page I get a runtime error. Any suggestions? Complete newbie here so layman terms welcome!

The error is...

Server Error in '/' Application. Runtime Error 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 <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors>

2
  • 1
    Welcome to stack overflow Twiss, can you include the runtime error you are getting? Either a screenshot or pasting in the text will work. I'm not very knowledgeable on ASP.net, so I cannot help you, but it will help others in debugging your problem. Thanks! Commented Aug 25, 2018 at 8:17
  • @Twiss Important information like that needs to be put in your question, rather than in a comment. You can edit your question by pressing that word underneath your question. I've done that for you, so now you can delete your comment. Commented Aug 25, 2018 at 8:45

2 Answers 2

2

The error message tells you what you need to do. Basically, you cannot see the actual error until you add these lines to your web.config file

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

You probably already have a web.config with so in which case you'll just need to add the inner xml somewhere within the body of the file.

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

3 Comments

Thanks Rob, I added the lines but now get this error?
Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The entry 'EventLogProvider' has already been added. Source 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. It could, however, be viewed by browsers running on the local server machine.
You must have EventLogProvider twice in your web.config then? Make sure you don't have any duplicate elements in the web.config.
0

From the above comment the error says "The entry 'EventLogProvider' has already been added.". Delete the duplicate key with same name in your config file "EventLogProvider". You need also remove this line -

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

And add what Rob mentioned in the answer.

More on this -

error: the details of the application error from being viewed remotely

Please check the below answer also-

The entry '' has already been added error

1 Comment

Thanks for help. The web host provides the web.config, machine.config and a web schlund.config file and as I'm new to all of this I think there is something overriding the error messages. I removed all config files and just put a web.config file in the root directory with just the code above and it worked, I now can see why the page wasn't loading and have fixed the problem. Thank you all!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.