Ejemplo n.º 1
0
    // Handle the connection to the server 
    protected void btnConnect_Click(object sender, EventArgs e)
    {

        string Port = Request.ServerVariables["SERVER_PORT"];
        string Protocol = Request.ServerVariables["SERVER_PORT_SECURE"];
        string basePath = string.Empty;

        if (Port == null || Port == "80" || Port == "443")
            Port = "";
        else
            Port = String.Format(":{0}", Port);
        
        if (Protocol == null || Protocol == "0")
            Protocol = "http://";
        else
            Protocol = "https://";

        basePath = String.Format("{0}{1}{2}{3}/Default.aspx", Protocol, Request.ServerVariables["SERVER_NAME"], Port, Request.ApplicationPath);

        IntellisyncServer server = new IntellisyncServer(basePath);
        UserCredentials credentials = new UserCredentials(userId.Text, password.Text, "");

        if (server.TestAuthenticate(userId.Text, credentials.Password, string.Empty))
        {
            testMessage.Text =  GetResource("SuccessMessage");
        } else 
        {
            testMessage.Text = GetResource("FailMessage");
        }
    }
Ejemplo n.º 2
0
    // Handle the connection to the server
    protected void btnConnect_Click(object sender, EventArgs e)
    {
        string Port = Request.ServerVariables["SERVER_PORT"];
        string Protocol = Request.ServerVariables["SERVER_PORT_SECURE"];
        string basePath = string.Empty;

        if (Port == null || Port == "80" || Port == "443")
            Port = "";
        else
            Port = String.Format(":{0}", Port);

        if (Protocol == null || Protocol == "0")
            Protocol = "http://";
        else
            Protocol = "https://";

        basePath = String.Format("{0}{1}{2}{3}/Default.aspx", Protocol, Request.ServerVariables["SERVER_NAME"], Port, Request.ApplicationPath);

        IntellisyncServer server = new IntellisyncServer(basePath);
        UserCredentials credentials = new UserCredentials(userId.Text, password.Text, "");

        if (server.TestAuthenticate(userId.Text, credentials.Password, string.Empty))
        {
            testMessage.Text =  GetResource("SuccessMessage");
        } else
        {
            testMessage.Text = GetResource("FailMessage");
        }
    }