コード例 #1
0
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            // Glue Login call here.
            string authToken = Glue.Login(TextBoxUserName.Text, TextBoxPassword.Text);

            bool authenticated = !string.IsNullOrEmpty(authToken);

            if (authenticated)
            {
                // Save authToken for this session
                Session["authToken"] = authToken;
                TextBoxResponse.Text = authToken;
                ButtonLogin.Enabled  = false;

                // Initialize indices of project and model index
                Session["projectIndex"] = 0;
                Session["projectId"]    = "";
                Session["modelIndex"]   = 0;
                Session["modelId"]      = "";
            }

            // Show the request and response in the form.
            // This is for learning purpose.
            IRestResponse response = Glue.m_lastResponse;

            TextBoxRequest.Text  = response.ResponseUri.AbsoluteUri;
            TextBoxResponse.Text = response.Content;
        }
コード例 #2
0
        //==========================================================
        // Login/Logout
        //==========================================================
        protected void ButtonLogin_Click(object sender, EventArgs e)
        {
            // Glue Login call here.
            string authToken = Glue.Login(TextBoxUserName.Text, TextBoxPassword.Text);

            // If success, change the button to logout
            if (!string.IsNullOrEmpty(authToken))
            {
                // If success, change the button to logout.
                ButtonLogin.Enabled  = false;
                ButtonLogout.Enabled = true;

                // Save autoToken for this session
                Session["authToken"] = authToken;
            }

            // Show the request and response in the form.
            // This is for learning purpose.
            ShowRequestResponse();
        }