Question

We have a site that was originally a classic ASP site. It was converted to .NET a few years ago as website projects. There is almost no functionality in the C# code. It uses a master page and include files and contains one form. The rest of the site could be HTML pages, except that they use the master page, because the content is all static text.

Each subdirectory has a default file, called "index." When we convert to a web application project and compile, we get the error "Type 'index' already defines a member called 'Page_Load' with the same parameter types." We get that error for every page named "index" on the site.

There isn't actually any code in the CS file for any of those pages, just the default that gets created when you create a page in Visual Studio (the public partial class, and the Page_Load).

Is it a problem to have multiple files with the same name, even if they're in separate subdirectories, in a web application project? What's the best way to address this?

Was it helpful?

Solution

You should create namespace and each page should be in its own namespace according to its directory, for example:

namespace MyNamespace.Directory1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top