Welcome Guest Search | Active Topics | Sign In | Register

Roles and database connectivity Options
dusion
Posted: Tuesday, April 15, 2008 6:58:31 AM
Rank: Newbie
Groups: Member

Joined: 6/16/2007
Posts: 2
I'm try to handle errors on my site, my error page has the main menu as well. When I specify what roles can view menu items, the menu accesses the database to see if the user is in the role specified. If database connectivity goes down, for whatever reason, the menu throws the error. How can I trap this error? Since the menu is used on the errorpage, my exception handler generates a loop?
eo_support
Posted: Tuesday, April 15, 2008 7:08:54 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

The easiest way is to enclose the data binding code in a try catch block. Try put the following code in your Page_Load:

Code: C#
try
{
    Menu1.DataBind();
}
catch (Exception e)
{
   //do whatever you'd like
}


I believe The menu automatically calls DataBind by default if you set its DataSourceID property. However if you call it manually in your code, the menu won't call it again automatically.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.