protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["oauth_token"] == null)
     {
         oAuth = new oAuthDossia();
         Response.Redirect(oAuth.GetTokens());
     }      
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["oauth_token"] == null)
        {
            oAuth = new oAuthDossia();
            Response.Redirect(oAuth.GetTokens());
        }
        else if (!Page.IsPostBack)
        {        
            string accessTokenRedirectUrl = string.Empty;
            string apiGetUrl;
            string getRecordUrl = string.Empty;
            string responseText = string.Empty;

            oAuth = new oAuthDossia();
            //Authorize and use the token and secret to get the access token
            oAuth.AccessTokenGet();
            if (oAuth.Token.Length > 0 && oAuth.TokenSecret.Length > 0)
            {
                try
                {
                    apiGetUrl = oAuthDossia.DOSSIA_API_URL + "records";
                    //get the access to API url
                    accessTokenRedirectUrl = oAuth.AccessToAPILink(apiGetUrl, oAuth.Token, oAuth.TokenSecret, oAuthDossia.Method.GET.ToString());
                    //do the request and set the response to text
                    responseText = oAuth.MakeWebRequest(accessTokenRedirectUrl);
                    this.txtDossiaAPIResponse.Text = responseText;
                    clearSession();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                Response.Redirect("APITest.aspx", false);
            }
        }   
    }