1

I have inherited a code base that does not compile properly. The project is a Visual Studio 2005 web site. I want to move it to a web application. The first thing I am trying to do is move the "App_Code" directory over. The pages in the application rely on some class objects that are defined in the "App_Code" directory.

Visual Studio 2005 does not directly give you the ability to add a "App_Code" directory. Because of this, I manually created one. I then placed the class definitions in this directory. I then compiled the web application.

Next I attempted to migrate the Default.aspx page. This page derives from a class called GenericPage defined in the App_Code directory. However, I cannot seem to reference this class. The definition does not use any namespaces. Where does this code get stored? How do I reference it?

Thank you!

user70192
  • 13,786
  • 51
  • 160
  • 240

3 Answers3

1

Maybe this tutorial is helpful: Walkthrough: Converting a Web Site Project to a Web Application Project in Visual Studio 2005

I'm reading at various places that the App_Code folder should not be used in Web Application Projects. See also this SO question: App_Code folder issues

The solution given in that last link is:

Create a new folder called code or something and put them in there.

Community
  • 1
  • 1
pyrocumulus
  • 9,072
  • 2
  • 43
  • 53
1

More info here: Automatic reference of class files inside App_Code vs reference of class files outside App_Code

Community
  • 1
  • 1
IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
0

You might have to try grabbing it by using the global namespace.

Example:

var somePage = new global::DefaultNamespaceForProject.PageICantFind();
Joseph
  • 25,330
  • 8
  • 76
  • 125