你可以作一个类让它继承于 System.Web.HttpApplication,如: public class MyGlobal: System.Web.HttpApplication,然后在系统自带的Global里面继承你的新类名,方法可以这么写static public SqlConnection OpenConn{}
你应该声明静态变量而不是函数 public static string sharehtml引用时:Label1.text=sharecode.sharehtml; 直接给Label1赋值为该静态变量
public static void 你的函数名()
{
..........
}
public class MyGlobal: System.Web.HttpApplication,然后在系统自带的Global里面继承你的新类名,方法可以这么写static public SqlConnection OpenConn{}
public static string sharehtml引用时:Label1.text=sharecode.sharehtml;
直接给Label1赋值为该静态变量
直接用就行了,而且直接Response,是Response在<Html></Html>标签之外,不合标准,而且重定向是会引发异常,正确的方法应该是写个用户控件
{
YouClassName obj = new YouClassName();
Response.Write(obj.你的函数().ToString());
}
{
public static returntype function01(){}
public static returntype function02(){}
...
}你的贴子是100分的,在给分时,必须把100分给完,不多也不少。
例如:
<script language="C#" runat="server">
int hhh()
{
........
}class myclass
{
........
}
</script>