Hi,
I've picked up a partially developed ASP.Net app in c#. There's a page called ErrorDisplay.aspx, with a code behind of ErrorDisplay.aspx.cs. So far, so good. The code behind defines a partial Class ErrorDisplay, with a property ExceptionDetails (of type Exception).
The catch code on all the other pages reads:
catch (Exception ec)
{
ErrorDisplay.ExceptionDetails = ec;
Response.Redirect("ErrorDisplay.aspx");
}
But, when I build the site, I get a collection of errors:
"The name 'ErrorDisplay' does not exist in the current context
N:\My Documents\ASPNET\Project1\Logon.aspx.cs"
All of the pages are at the same level, and I don't think there's a Namespace issue - I tried wrapping ErrorDisplay in a Namespace command, but VS protested there was already an ErrorDisplay class in the global namespace.
So why am I getting these "does not exist in current context" errors, and how do I fix it?
Eric FlammPosted Jul 6, 2007, 9:00 AM
Does that give anyone a clue why it won't run on my desktop? Is there a .Net setting somewhere that could take 1 page out of context or prevent access to classes declared in another page's code-behind? Could it be an IE setting (seems unlikely)?
Any expert help would be appreciated.
-Eric
Eric FlammPosted Jul 4, 2007, 6:13 PM
ErrorDisplay.aspx is in the same directory as the pages that target it with their exceptions. The response.redirect to ErrorDisplay works fine; it seems to be the ExceptionDetails object that's driving the error.
Jan MontanoPosted Jul 3, 2007, 11:26 PM
Honestly, I'm a noob(newbie) when it comes to web development so please bear with me. the Line ErrorDisplay.ExceptionDetails = ec; How is ErrorDisplay declared? is ExceptionDetails a static call? Perhaps there's something wrong with the implementation/declaration of ErrorDisplay/ExceptionDetails. Check if it's public, private or static.