3
Answers

The name abc does not exist in the current context

Eric Flamm

Eric Flamm

17y
3.3k
1

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?

Answers (3)
Next Recommended Forum