无法调用我的班级

时间:2017-03-12 17:00:32

标签: asp.net methods

我不是专家,但我必须下载dll并使用创建的类与文档平台进行make集成,

我找到了一些课程,并且我在网站上添加了一些课程,例如:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Net;
using System.Net.Cache;
using System.Net.Http;
using DocuWare.Platform.ServerClient;

public class Conectador
{
    public Conectador()
    {}

    static Uri uri = new Uri("http://192.168.0.63/docuware/platform");

    public static ServiceConnection Connect()
    {
        return ServiceConnection.Create(uri, "administrador", "@dmm0N");
    }

public static ServiceConnection ConnectWithUserAgent()
{
    return ServiceConnection.Create(uri, "administrador", "@dmm0N",
        userAgent: new System.Net.Http.Headers.ProductInfoHeaderValue[] {
                new System.Net.Http.Headers.ProductInfoHeaderValue("DocuWare+.NET+API+Test+Client", "1.0")
        });
}

public static ServiceConnection ConnectWithOrg()
{
    return ServiceConnection.Create(uri, "administrador", "@dmm0N", organization: "Digital Solution Digitsol S.A.");
}

public static ServiceConnection ConnectWithCaching()
{
    var handler = new WebRequestHandler() { CachePolicy = new RequestCachePolicy(RequestCacheLevel.Default) };
    return ServiceConnection.Create(uri, "administrador", "@dmm0N", httpClientHandler: handler);
}



}

当我尝试在我的命令中调用它时,我不能:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _01_Conexion : System.Web.UI.Page
{
    Conectador cn = new Conectador();
    protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
      cn....     => I have nothing Here!!!
}
}

我错过了什么?我的错误是什么? 我希望有人能帮助我......

祝你好运

1 个答案:

答案 0 :(得分:0)

我会尝试在构造函数之外声明类的字段cn。我不用c#编程,但我认为它是作用于你的构造函数的,因此不存在于你的其他方法中。