We are porting a Classic ASP app to ASP.NET. What do we do about the #INCLUDE (.inc) files? Now they're causing build errors because ASP.NET thinks the variables are "not declared".
You haven't stated what is in the .inc files. Lets assume there are a bunch of const definitions and a few helper functions.
There are a couple of variations that you might consider.
- Often there is a single .inc which gets included in all or most ASP pages.
- Other .inc files get included in a few ASP pages because they just encapsulate some shared functionality.
For variation 1 it might help to create a class that derives from Page
that exposes the original .inc files constants as properties and its functions as methods. Have all the ported ASP to ASP.NET pages inherit from this new class rather than directly from Page
.
For variation 2 create classes in App_Code that contain static properties and methods (or direct ports of VBScript classes if that's what the .inc contained). The ASP to ASP.NET page ports that use these includes would need to prefix their usage of members from the original .inc file with the name of the class of which they are not static (shared) members.
If the includes originally contain static markup then a better port for those is to create representative .master pages and have the ported ASP pages use those masters appropriately.
You can port them in the same way you did in ASP:
<!--#include virtual="/include/flash-check_inc.asp"-->