ASP.NET命名空间 [英] ASP.NET Namespace

查看:174
本文介绍了ASP.NET命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是当我创建ASP.NET项目Default.aspx页面所在的命名空间?

What is the namespace the Default.aspx page resides in when I create an ASP.NET project?

和如何找到任何其他ASP.NET页面的命名空间中的项目?

And how to find the namespace of any other ASP.NET page in the project?

我使用VS2005。我首先创建一个空白溶液,然后添加一个网站到它。

I am using VS2005. I first created a blank solution and then added a webSite to it.

当我点击右键按钮,转到添加新网站 - 菜单中我发现下面的模板ASP.NEt网站已(第1模板),然后我说这我SLN

When I click right-button and go to 'Add New Web Site' - menu I find the following template ASP.NEt WebSites(1st template), then I added this to my sln.

我使用C#和VS2005。这不会在这种情况下,匹配VS2008

I am using C# and VS2005. This will not match VS2008 in this case.

推荐答案

Web站点没有/支持命名空间。 Web应用程序做的。

Web Sites do not have/support namespace. Web Applications do.

要回答这个问题,因为创建一个新的网站,命名空间不发挥作用。至于如何从一个WebForm页面访问其他的WebForm页面类,我还没弄清楚是有原因的。而且我不认为这是做-能(纠正我,如果我错了)。

To answer the question, since a new 'Web Site' is created, namespace doesn't come into play. As to how to access other WebForm page classes from a Webform page, I haven't figure a reason for that. And I do not think it is do-able (correct me if I'm wrong).

反正有办法来解决。如果你有一些reuable业务/ UI /其它类一个web表单内使用逻辑,只需将这些方法出来说下APP_ code XXX.cs文件。没有必要为命名空间,可以将所有表单类中使用它。

Anyway there are ways to get around. If you have some reuable business/UI/other logics used within a class of one the webforms, simply move those methods out to say XXX.cs file under App_Code. There is no need for namespace and you can use it within all the webform classes.

这篇关于ASP.NET命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆