views:

80

answers:

1

I am developing a VS 2008 web application in C#. I am trying to include a namespace that is stored in one of my folders. So instead of:

using ADONET_namespace

it is stored in "Admins" folder. How do I modify this aspx.cs file to include Admins/ADONET_namespace?

Currently I get following error from aspx.cs file: The type or namespace name 'ADONET_namespace' could not be found (are you missing a using directive or an assembly reference?)

+5  A: 

If you want to reuse classes within your web app you need to put the classes in .cs files within the App_Code directory of the application, or you can compile them into a DLL and place that within the bin directory. At that point, you may include using myNamespace; in whatever class or page that needs to be able to use those classes.

Anthony Pegram
Yep, this fixed it! Thanks!
salvationishere
+1 this is what I meant. Specially in asp.net website you wont have dynamic compilation of ur code in app_code like in a website.
Perpetualcoder
This is only true if he's using a Web Site "project" (created by File->New Web Site). If he used a Web Application Project (created by File->New Project) then he wouldn't have this problem, and could put his code whereever he liked.
John Saunders