Re: Intermittent Referencing Bug in ASP.NET 2.0 / VS 2005



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

steve_barker333@xxxxxxxxxxx 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.

.



Relevant Pages

  • Intermittent Referencing Bug in ASP.NET 2.0 / VS 2005
    ... web project: ... pages that are "erroring" are all in a folder called MainPages, ... Is it a bad idea to refer to the type of the previous page (using ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Sharepoint URL error
    ... or folder, or refer to a valid file or folder that is not in the current ... This newsgroup only focuses on SBS technical issues. ... you may want to contact Microsoft CSS directly. ...
    (microsoft.public.windows.server.sbs)
  • Re: Directory Layout Suggestions
    ... Go back to your Web Project and right click on the solution name> choose add existing project> navigate to the dll project you just created and select it. ... use the App_Code folder to create your classes for what will eventually go into your class library. ... When yer ready to compile the App_Code files into a dll, exclude them from the Web Project, pop em into yer Class Library Project, compile the dll, reference it in your Web Project and yer set. ... he creates another subdirectory called Class Libraries. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: SBS2003 Exchange 2003 SP2 OMA Not Functioning
    ... Let us refer to the following steps to troubleshoot the issue: ... 6.In addition,Please Add ASPNET user account with write permissions to this ... Files.Right-click "Temporary ASP.NET Files" folder, select Properties, then ... from your newsreader: microsoft.private.directaccess.partnerfeedback. ...
    (microsoft.public.windows.server.sbs)
  • Re: Virtual Directory not working
    ... But you can have ScrollKeeperModule in both web.config ... current application folder. ... so when you refer to your controls ... does seem to work and knows to look at the root of the Application. ...
    (microsoft.public.dotnet.framework.aspnet)