asp.net webforms - how to handle multiple pages with the same name in one web project?
I have a web application with several different top-level directories, and some of the pages with different directories have the same name - for example:
foo/
search.aspx
list.aspx
bar/
search.aspx
list.aspx
baz/
search.aspx
list.aspx
etc.
The problem is that the class names for the code-behind files conflicts - each search is trying to create a class "search". Is it possible to configure individual directories to use the directory name as part of the class, or perhaps a namespace?
I tried adding a namespace to one of the search pages, and that seemed to work, but that means changing e开发者_如何学编程very page, designer, and aspx @Page directive manually. Is there a way to tell VS2008 to include the directory name as part of the name space?
Use namespaces
namespace {Project Name}.foo { public class search {}}
namespace {Project Name}.bar { public class search {}}
I don't know if there's a way to manually update each page's inherits properties and the likes
精彩评论