ASP.NET 2.0 Namespaces?

X

xenophon

I have a simple ASP.NET 2.0 site. I have created one page in the site
root, and another within 3 subfolders.
The first page has a namespace signature of "TestSite". The second
page is "TestSite.dir1.dir2.dir3".

In the first page, I try to get an instance of the second page, but
when typing "TestSite." in Visual Studio 2005 I get no IntelliSense
that the second page exists.

How can I make namespaces work with ASP.NET 2.0?


Thanks.
 
S

Scott Allen

It's not a namespace problem, exactly, it's more that the two pages
will be in seperate assemblies and not able to see each other's type.
You can use @ Reference Page="..." or @ PreviousPage to make sure a
reference to the other assembly exists.

An even better idea is to declare an interface in App_Code or a class
library for your pages to implement. With that approach you don't get
too coupled with a specific web form in a directory.


http://odetocode.com/Blogs/scott/archive/2005/06/30/1889.aspx
 
X

xenophon

I am actually trying to work an ASP.NET 1.1 site into the way things
2.0 works, so I do have a "Template Page" class that all pages inherit
from. However, I still can't get IntelliSense from one page to another
in VS.NET 2005. I am atempting to use the PageMethods library.
 
S

Scott Allen

I am actually trying to work an ASP.NET 1.1 site into the way things
2.0 works, so I do have a "Template Page" class that all pages inherit
from. However, I still can't get IntelliSense from one page to another
in VS.NET 2005. I am atempting to use the PageMethods library.

I'd try the @ Register directive - that will bring the other page's
type into scope.
 
F

fabrice.marguerie

Another solution is to use the Web Application model, which works like
with Visual Studio 2003, and forget about the default Web Site model
coming with VS 2005.
This way you can reference pages like you do with VS 2003.

See the following links:
http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/
http://weblogs.asp.net/scottgu/archive/2006/02/10/437943.aspx
http://weblogs.asp.net/scottgu/archive/2005/12/07/432630.aspx
http://webproject.scottgu.com

But I would still recommend PageMethods anyway ;-)
It works with both models.

Fabrice
http://metaSapiens.com/PageMethods
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top