Exception when database access problems

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
2/9/2007 7:20:35 AM
Gravatar
Total Posts 488

Exception when database access problems

Version 2.2.1.5 MSSQL.
When error occurs trying to access the portal database (in my case I forgot to create database user) an unhandled exception is thrown.
2/9/2007 4:09:00 PM
Gravatar
Total Posts 18439

Re: Exception when database access problems

A exception being raised with an incorrect connection string seems not ureasonable to me. Did the error message not have the correct information about the problem?
You think we should catch this and forward to the Setup page and show a friendlier message?

Thanks,

Joe
2/11/2007 8:16:28 AM
Gravatar
Total Posts 18439

Re: Exception when database access problems

Hi Alexander,

After more thought, this seems a very good idea to handle this error as it improves the setup experience.

If setting up a site on a remote host, previously the user would have to check the error log because the error is not displayed, only the friendly error page was shown. This was bad because new users may have no idea about the existence of the error log. Installing on a local machine was ok because the error message shown is clear.

Now the user will be directed to the setup page instead and shown an error message that they need to check the connection string. The raw error message will also be displayed to help diagnose the problem with the connection string.

This is implemented in svn.

Thanks,

Joe
2/12/2007 4:56:15 AM
Gravatar
Total Posts 488

Re: Exception when database access problems

I am not sure it's a good solution because this message is also shown if there are some database problems on production site, and "welcome to setup" message is shown to common user from the internet.

Better solution will be some neutral message like "This site is experiencing problems with database, more detailed information can be found in web site log" and no stack trace.
2/12/2007 8:22:09 AM
Gravatar
Total Posts 18439

Re: Exception when database access problems

Yeah I struggled with that decision because it defeats the purpose of the friendly error page in hiding the error details from possible hackers.

It would be nice to show it if we can be sure its just during setup but I don't know a way to know this if the db is not available.

So I can remove the stack trace and error detail but I can't solve the original problem without redirecting to the setup page. I think its ok to see the setup page if the database is unavailable as that is a narrow kind of error but I agree its probably better not to show the error detail.

Any user can currently go to the /Setup/Default.aspx page or the /Setup/Upgrade.aspx page if they navigate there.
There is nothing particularly sensitive displayed there other than version info

Maybe I should add a Web.config setting AllowNavigationToSetup which would default to true, but after installation it could be set to false and we could either re-direct to the error.htm or to AccessDenied unless the user is logged in as admin.

What do you suggest?

Joe
2/12/2007 8:44:09 AM
Gravatar
Total Posts 488

Re: Exception when database access problems

Let it redirect to setup if database is not available, with no error details (like stack trace).

As for manual navigating to setup page, it would be nice to check if the setup is needed and redirect to home page in case it is not.
2/12/2007 9:28:13 AM
Gravatar
Total Posts 18439

Re: Exception when database access problems

Well one thing I like about being able to go to setup page even when setup is complete is that I have had support incidents where the site was working fine then somehow folder permissions changed and the site no longer works.

The setup page will show these problems if they exist so its nice to have the option to go there, I don't want to force redirect to home unless its a configured option.

Also with the Upgrade.aspx page there is special functionality that is only apparent in certain situations.
For example, if the site is upgraded an attempt to run the upgrade scripts will be made but in a hardened security installation it may not be possible to run the script using the connection string so there is an option if this is detected so that a different connnection string can be entered if the existing one has insufficient permission.

For example, I may create my MS SQL db tables and procs as sa but then I may create a user which only has permission to exec stored procedures and has no direct table permission. In this case the upgrade cannot happen automatically so the upgrade page allows the user to try a different connection string. If ssl is available ssl is forced in this situation.

Yes, I know I need to document these things ;-) I need a secretary

Joe
2/12/2007 9:30:09 AM
Gravatar
Total Posts 18439

Re: Exception when database access problems

Actually after more thought it could cause an error loop if we try to redirect to home from setup pages.
2/12/2007 9:33:15 AM
Gravatar
Total Posts 488

Re: Exception when database access problems

I mean that the setup page should check for all the problems, and if no problem occurs now then redirect to home.

> Yes, I know I need to document these things ;-) I need a secretary
2/12/2007 9:35:30 AM
Gravatar
Total Posts 18439

Re: Exception when database access problems

Ok, yes that will work. I will make it a configuration option whether to redirect.

Thanks,

Joe
You must sign in to post in the forums. This thread is closed to new posts.