I blogged about this before and, maybe I didn't clearly explain the problem.
Take a look at the following code screen shots from two different .NET 2.0 projects:
Windows Forms:

ASP.NET Web Page:

Notice anything different? You'll see that both class files have their usual “using” statements, both use partial classes, but the ASP.NET page is without a namespace declaration by default.
If you have VS2005 and would like to play along at home, then create a new solution, add a Windows Forms project and an ASP.NET web site. You'll get the same results.
In fact, you'll get namespaces everywhere there's code, except for web sites and web service projects.
This can't be a bug and I'm giving the ASP.NET team the benefit of a doubt and I'm assuming that this is done by design.
I just can't figure out why they would make it this way.
My best theory is that the ASP.NET team wanted C# to behave in a manner consistent to VB.NET, but once again, I can't explain why anyone would want that. ![]()
Can somebody explain the Case of the Missing Namespace?
Thanks in Advance,
Frank
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.