本文介绍了Web应用程序中的当前上下文ERROR中不存在全局类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,


我在c#.net中创建了一个Web应用程序,它在我们的局域网系统中正常运行。


现在我将此应用程序上传到WWW(在Web域中),在此应用程序中,我们使用全局类文件来存储全局变量值,以便我可以在应用程序的任何位置使用它们。


但是当我运行Web URL时,它会抛出一条错误消息:


"globalclass在当前上下文中不存在"。



这是我的全球类代码:


命名空间AssetTrackingSystem

{

  ;  public static class globalclass:System.Web.UI.Page

    {

        //用于位置级别条形码

       公共静态字符串strBar;

        //用于将assetId转换为条形码

        public static string assetId;

        public static string assetName;

        public static string assetid = null;

        public static string assetname ="" ;;

        public static DataTable mydata;

        public static string username ="" ;;&b $ b        public static string userid ="" ;;

       公共静态字符串cf;

        public static string logincompanyName;

        public static string loginfinancialfrom;

        public static string loginfinancialTo;

        public static string companyId;

        public static string companyfinancialfrom;

        public static string ddllevelUpdate1;

        public static string ddllevelUpdate2;

        public static string mycode = null;

        

        public static int mycodelength = 0;

        public static string mycodePrefix ="" ;;&b $ b        //公共静态字符串mycodeSuffix ="" ;;

        //用于公司报告



       公共静态字符串ReportCompanyname;

       公共静态字符串ReportAddress1;

       公共静态字符串ReportCity;

        public static string ReportZipCode;

       公共静态字符串ReportCountry;

        public static string ReportEmailId;

        public static int amcnoteification = 0;




        //对于资产报告



        public static string empCode;

        public static string empName;

        public static string empDepartment;

        public static string Categ;

       公共静态字符串Loc;

        //用于创建新公司的用户名和密码,配置

        public static string uId;

        public static string uPassword;



b


     ;     // varible用于存储完成创建新公司流程的完整步骤的值。



        public static string newcompanyloop;



        //商店商品组件名称的变量。



        public static string itemComponent;

}


}


............. .................................................. .....


我使用这个类的方式:


globalclass.newcompanyloop = TextBox1.Text;


............................................... .........................................




请有人帮忙。







Rajababu Sharma

解决方案


Dear all,

i have created a web application in c#.net and it is running fine in our LAN system.

Now i uploaded this application in the WWW(In web domain), in this application we have used a global class file to store global varials values so that i can use them any where in the application.

But when i run the Web URL, it throws an error message:

"globalclass does not exist in the current context".

Here is my global class code:

namespace AssetTrackingSystem
{
   public static class globalclass: System.Web.UI.Page
    {
        //for Location level Barcode
        public static string strBar;
        //for convert assetId into barcode
        public static string assetId;
        public static string assetName;
        public static string assetid = null;
        public static string assetname = "";
        public static DataTable mydata;
        public static string username = "";
        public static string userid = "";
        public static string cf;
        public static string logincompanyName;
        public static string loginfinancialfrom;
        public static string loginfinancialTo;
        public static string companyId;
        public static string companyfinancialfrom;
        public static string ddllevelUpdate1;
        public static string ddllevelUpdate2;
        public static string mycode =null;
        
        public static int mycodelength = 0;
        public static string mycodePrefix = "";
        //public static string mycodeSuffix = "";
        // for company report

        public static string ReportCompanyname;
        public static string ReportAddress1;
        public static string ReportCity;
        public static string ReportZipCode;
        public static string ReportCountry;
        public static string ReportEmailId;
        public static int amcnoteification = 0;


        // for Asset Report

        public static string empCode;
        public static string empName;
        public static string empDepartment;
        public static string Categ;
        public static string Loc;
        //user name and password for creating new company, configuration
        public static string uId;
        public static string uPassword;




        //varible is used to store value for completing full step of process of creating new company.

        public static string newcompanyloop;

        //variable for store item component name.

        public static string itemComponent;
}

}

....................................................................

The way i use this class:

globalclass.newcompanyloop=TextBox1.Text;

........................................................................................

i have searched this issue in the net but useless.

Please someone help.


Rajababu Sharma

解决方案


这篇关于Web应用程序中的当前上下文ERROR中不存在全局类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 18:43