473,425 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Intermittent Referencing Bug in ASP.NET 2.0 / VS 2005

Hi guys!

I keep getting the following error reported by VS 2005 in my ASP.NET
2.0 web project:

"The type or namespace name 'MainPages_XXX' could not be found (are you
missing a using directive or an assembly reference?)"

The line of C# code (in the "code-behind" file) that error refers to
looks something like this:

if (Page.PreviousPage == null || !(Page.PreviousPage is MainPages_XXX))
{
//Some code....
}

For instance, the error might occur in a page called Page1.aspx (with
code behind file Page1.aspx.cs). In this page, I might refer to another
page, say Page2.aspx (code behind Page2.aspx.cs) in order to check that
the previous page was the correct type. In this particular project,
I've used folders to break up the structure of my ASP.NET pages. The
pages that are "erroring" are all in a folder called MainPages,
hence the "MainPages_" prefix, which VS 2005 has added itself. In the
cases where I get errors, both pages are in the same folder!

Closing and re-opening VS 2005 fixes the problem, but clearly, for a
large solution, that is not a viable way to get around this!

Has anyone else seen this problem? Is there a work around or a hot fix?
Is it a bad idea to refer to the type of the previous page (using
"is") in order to check how you got to the page you're on?

You help would be greatly appreciated!

Thanks in advance,

Steve.

Oct 10 '06 #1
4 1453
Do you have the <%@ Reference directive at the top of Page1.aspx
referring to the other page you want to access?

The page model in asp.net 2.0 has changed from 1.1, now you have to use
a reference directive to access other aspx pages, if you need Page1
access Page2, and Page2 to access Page1, then that would create a
circular reference, in which case you can create an interface that your
page implements and then pass the interface around instead (better idea
IMO)

hope i didn't go off base there =) Just trying to point out problems I
ran into.

Sean

st*************@hotmail.com wrote:
Hi guys!

I keep getting the following error reported by VS 2005 in my ASP.NET
2.0 web project:

"The type or namespace name 'MainPages_XXX' could not be found (are you
missing a using directive or an assembly reference?)"

The line of C# code (in the "code-behind" file) that error refers to
looks something like this:

if (Page.PreviousPage == null || !(Page.PreviousPage is MainPages_XXX))
{
//Some code....
}

For instance, the error might occur in a page called Page1.aspx (with
code behind file Page1.aspx.cs). In this page, I might refer to another
page, say Page2.aspx (code behind Page2.aspx.cs) in order to check that
the previous page was the correct type. In this particular project,
I've used folders to break up the structure of my ASP.NET pages. The
pages that are "erroring" are all in a folder called MainPages,
hence the "MainPages_" prefix, which VS 2005 has added itself. In the
cases where I get errors, both pages are in the same folder!

Closing and re-opening VS 2005 fixes the problem, but clearly, for a
large solution, that is not a viable way to get around this!

Has anyone else seen this problem? Is there a work around or a hot fix?
Is it a bad idea to refer to the type of the previous page (using
"is") in order to check how you got to the page you're on?

You help would be greatly appreciated!

Thanks in advance,

Steve.
Oct 10 '06 #2
Hi Sean!

I'm pretty sure that this is not a referencing problem, since the
solution compiles if I close it down and open it. I think it's more a
bug with Studio. Thanks for your suggestions though.

There is not really any benefit in me using an Interface in what I'm
doing, since Page 1 is only ever used from Page 2, and Page 2 could use
any number of the few public properties that Page 1 exposes. I'd only
use an Interface if two pages that expose similar properties (say Page
1a and Page 1b) could lead to Page 2.

I personally don't think I've done anything that is frowned upon in my
code; it just doesn't always compile!

Thanks again!

Steve.

Sean Chambers wrote:
Do you have the <%@ Reference directive at the top of Page1.aspx
referring to the other page you want to access?

The page model in asp.net 2.0 has changed from 1.1, now you have to use
a reference directive to access other aspx pages, if you need Page1
access Page2, and Page2 to access Page1, then that would create a
circular reference, in which case you can create an interface that your
page implements and then pass the interface around instead (better idea
IMO)

hope i didn't go off base there =) Just trying to point out problems I
ran into.

Sean

st*************@hotmail.com wrote:
Hi guys!

I keep getting the following error reported by VS 2005 in my ASP.NET
2.0 web project:

"The type or namespace name 'MainPages_XXX' could not be found (are you
missing a using directive or an assembly reference?)"

The line of C# code (in the "code-behind" file) that error refers to
looks something like this:

if (Page.PreviousPage == null || !(Page.PreviousPage is MainPages_XXX))
{
//Some code....
}

For instance, the error might occur in a page called Page1.aspx (with
code behind file Page1.aspx.cs). In this page, I might refer to another
page, say Page2.aspx (code behind Page2.aspx.cs) in order to check that
the previous page was the correct type. In this particular project,
I've used folders to break up the structure of my ASP.NET pages. The
pages that are "erroring" are all in a folder called MainPages,
hence the "MainPages_" prefix, which VS 2005 has added itself. In the
cases where I get errors, both pages are in the same folder!

Closing and re-opening VS 2005 fixes the problem, but clearly, for a
large solution, that is not a viable way to get around this!

Has anyone else seen this problem? Is there a work around or a hot fix?
Is it a bad idea to refer to the type of the previous page (using
"is") in order to check how you got to the page you're on?

You help would be greatly appreciated!

Thanks in advance,

Steve.
Oct 11 '06 #3
I see,

In that case I would delete all the compiled dll's and .pdb's, do a
"clean solution" and then a "rebuild solution"

I've noticed in the past that some mechanism (not sure what portion),
seems to want to cache the dll's in memory, perhaps by clearing them
out completley and doing a complete recompile that might fix the
problem?

Let me know what you find out.

Sean

st*************@hotmail.com wrote:
Hi Sean!

I'm pretty sure that this is not a referencing problem, since the
solution compiles if I close it down and open it. I think it's more a
bug with Studio. Thanks for your suggestions though.

There is not really any benefit in me using an Interface in what I'm
doing, since Page 1 is only ever used from Page 2, and Page 2 could use
any number of the few public properties that Page 1 exposes. I'd only
use an Interface if two pages that expose similar properties (say Page
1a and Page 1b) could lead to Page 2.

I personally don't think I've done anything that is frowned upon in my
code; it just doesn't always compile!

Thanks again!

Steve.

Sean Chambers wrote:
Do you have the <%@ Reference directive at the top of Page1.aspx
referring to the other page you want to access?

The page model in asp.net 2.0 has changed from 1.1, now you have to use
a reference directive to access other aspx pages, if you need Page1
access Page2, and Page2 to access Page1, then that would create a
circular reference, in which case you can create an interface that your
page implements and then pass the interface around instead (better idea
IMO)

hope i didn't go off base there =) Just trying to point out problems I
ran into.

Sean

st*************@hotmail.com wrote:
Hi guys!
>
I keep getting the following error reported by VS 2005 in my ASP.NET
2.0 web project:
>
"The type or namespace name 'MainPages_XXX' could not be found (are you
missing a using directive or an assembly reference?)"
>
The line of C# code (in the "code-behind" file) that error refers to
looks something like this:
>
if (Page.PreviousPage == null || !(Page.PreviousPage is MainPages_XXX))
{
//Some code....
}
>
For instance, the error might occur in a page called Page1.aspx (with
code behind file Page1.aspx.cs). In this page, I might refer to another
page, say Page2.aspx (code behind Page2.aspx.cs) in order to check that
the previous page was the correct type. In this particular project,
I've used folders to break up the structure of my ASP.NET pages. The
pages that are "erroring" are all in a folder called MainPages,
hence the "MainPages_" prefix, which VS 2005 has added itself. In the
cases where I get errors, both pages are in the same folder!
>
Closing and re-opening VS 2005 fixes the problem, but clearly, for a
large solution, that is not a viable way to get around this!
>
Has anyone else seen this problem? Is there a work around or a hot fix?
Is it a bad idea to refer to the type of the previous page (using
"is") in order to check how you got to the page you're on?
>
You help would be greatly appreciated!
>
Thanks in advance,
>
Steve.
Oct 11 '06 #4
Hi Sean!

Thanks for your mail. Can you just confirm though, which dlls to clean?

I have found something else out:

When the error occurs, if I go to the .aspx.cs file relating to the
page mentioned in the error, and delete a semi-colon from the end of
any line, wait a while for the compiler to pick it up, and then replace
the semi-colon, the thing compiles OK. How weird is that?

Could this be to do with RAM? I've noticed that when the solution is
loaded, my RAM is all used up, and the PC is living entirely in virtual
memory. Perhaps a trip to my local PC shop would solve the problem?!

Thanks,

Steve.

Sean Chambers wrote:
I see,

In that case I would delete all the compiled dll's and .pdb's, do a
"clean solution" and then a "rebuild solution"

I've noticed in the past that some mechanism (not sure what portion),
seems to want to cache the dll's in memory, perhaps by clearing them
out completley and doing a complete recompile that might fix the
problem?

Let me know what you find out.

Sean

st*************@hotmail.com wrote:
Hi Sean!

I'm pretty sure that this is not a referencing problem, since the
solution compiles if I close it down and open it. I think it's more a
bug with Studio. Thanks for your suggestions though.

There is not really any benefit in me using an Interface in what I'm
doing, since Page 1 is only ever used from Page 2, and Page 2 could use
any number of the few public properties that Page 1 exposes. I'd only
use an Interface if two pages that expose similar properties (say Page
1a and Page 1b) could lead to Page 2.

I personally don't think I've done anything that is frowned upon in my
code; it just doesn't always compile!

Thanks again!

Steve.

Sean Chambers wrote:
Do you have the <%@ Reference directive at the top of Page1.aspx
referring to the other page you want to access?
>
The page model in asp.net 2.0 has changed from 1.1, now you have to use
a reference directive to access other aspx pages, if you need Page1
access Page2, and Page2 to access Page1, then that would create a
circular reference, in which case you can create an interface that your
page implements and then pass the interface around instead (better idea
IMO)
>
hope i didn't go off base there =) Just trying to point out problems I
ran into.
>
Sean
>
st*************@hotmail.com wrote:
Hi guys!

I keep getting the following error reported by VS 2005 in my ASP.NET
2.0 web project:

"The type or namespace name 'MainPages_XXX' could not be found (are you
missing a using directive or an assembly reference?)"

The line of C# code (in the "code-behind" file) that error refers to
looks something like this:

if (Page.PreviousPage == null || !(Page.PreviousPage is MainPages_XXX))
{
//Some code....
}

For instance, the error might occur in a page called Page1.aspx (with
code behind file Page1.aspx.cs). In this page, I might refer to another
page, say Page2.aspx (code behind Page2.aspx.cs) in order to check that
the previous page was the correct type. In this particular project,
I've used folders to break up the structure of my ASP.NET pages. The
pages that are "erroring" are all in a folder called MainPages,
hence the "MainPages_" prefix, which VS 2005 has added itself. In the
cases where I get errors, both pages are in the same folder!

Closing and re-opening VS 2005 fixes the problem, but clearly, for a
large solution, that is not a viable way to get around this!

Has anyone else seen this problem? Is there a work around or a hot fix?
Is it a bad idea to refer to the type of the previous page (using
"is") in order to check how you got to the page you're on?

You help would be greatly appreciated!

Thanks in advance,

Steve.
Oct 17 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Eddie J | last post by:
I'm getting an intermittent error when calling a .NET web service from a .NET console application. Both are using v.1.1.4322 of the framework. Any ideas on what could be causing this? It can...
6
by: jstaggs39 | last post by:
I want to create a Dcount and an If...Then...Else statement to count the number of records in a table based on the date that is entered to run the form. The If....Else statment comes in because if...
3
by: Lee Chapman | last post by:
Hi, I have a problem where my ASP.NET application occasionally generates a MissingFieldException exception. This unexpectedly happened on my development box, and so I was able to extract some...
0
by: gelangov | last post by:
I have posted this before. Now I have SQL server 2005 with Service pack 2. The problem is: I get intermittent problem either when I am loading a file into a table or exporting a table into a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.