1

When I create a new Web Site, the Default.aspx has the @ Page directive automatically set to Inherits="_Default". The codebehind file has public partial class _Default : System.Web.UI.Page but no namespace is specified. Does this mean that a random namespace name is generated at compile time?

So, I would like to create a class to handle some database work, but not sure what namespace it would belong to. Do I explicitly create a namespace for this? I.e. if my class were in the MyNamespace, then the Default.aspx would have Inherits="MyNamespace._Default" and the codebehind would also be wrapped in namespace MyNamespace{ ... }? Your clarifications are appreciated.

4
  • basically, it just is not in a namespace ! As easy as that ! Commented Mar 21, 2013 at 13:48
  • 2
    Did you see this question? Commented Mar 21, 2013 at 13:49
  • Yes, the answer is there. Thank you. Commented Mar 21, 2013 at 13:55
  • 1
    In summary, there are no namespaces in Web Sites. Your custom code goes to App_Code directory and the classes are then referenced automatically in your project. Commented Mar 21, 2013 at 13:59

1 Answer 1

0

There aren't any namespaces in web sites - when your site is compiled, the DLL's go to the App_Code directory and the classes are then referenced automatically in your project.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.