我有一个我想要的类,在一个大网站的所有页面(.aspx页面)。我该怎么做?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace masterbinoy.myGlobal
{
public static class myGlobal
{
static void checkAuthority(string url="~/Default.aspx")
{
}
}
}
现在我希望在所有其他网页中使用此名称空间,即使我创建一个新网页,就像默认系统名称空间一样
可以将
命名空间添加到web.config
文件中。另请注意,常见的命名约定要求命名空间采用 Pascal 大小写:Masterbinoy.MyGlobal
:
<system.web>
<pages>
<namespaces>
<add namespace="masterbinoy.myGlobal" />
</namespaces>
</pages>
</system.web>