Domanda

My web application project has an App_Code folder. I want to use the methods in these classes from my aspx.cs pages.

There are some classes in the App_Code folder I can access, and some I can't.

I can't spot any differences between them. For instance, all classes have the Build Action property set to Compile.

Is there anything else I should be doing to ensure I can call the classes in the App_Code folder?

È stato utile?

Soluzione

With Web Application Projects, you shouldn't be adding App_Code folder. It is intended for Website Projects. With Web Application projects, all your class files are anyways compiled.

The same result can be achieved by creating any folder (MyCodeFiles) and having all the class files inside it. That is why there is no option to create an App_Code option in the VS menu.

If it works, can you try adding a custom folder and see if it has any issues? If you still need the App_Code to be there, then try checking the namespaces of the files & the build action again.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top