What are the benefits of using namespaces in web pages?

I understand the pros of using namespaces in real application layers, but when it comes to the front-end, I'm not sure.

My project is a website (not WebApplication) and I get all sorts of problems (missing links for example) when I try to include named controls in it. Despite explicit declarations in web.config under system.web - pages - controls - add.

When it comes to actual views, Web Forms: When you create a new page, Visual Studio generates the codebehind class name from the path where you chose to create the file. Therefore, in most cases, I would say that the class names will be unique. If you move pages around, it becomes strange to see, for example, Start_DefaultPage, but in a different subfolder.

To summarize: Is it recommended to host namespaces in the web tier ? What are the pros and cons?

0


a source to share


2 answers


Yes. In the future, you may include external libraries that (coincidentally) use the same class names, and you don't want a namespace collision, as you very well know, to happen. Alternatively, you can have web applications in a virtual directory that inherit properties specified in the parent web.config. You also don't want to get involved in namespace conflicts. Generally speaking, this is just good programming practice.



+1


a source


Your problem is that you are using the "project" website. Stop doing this and you will stop experiencing these problems.



The websites are a bug by Microsoft. You don't need to introduce your mistake into your mistake.

+1


a source







All Articles