The remote server returned an error: (401) Unauthorized


#1

I use OAuth to connect twitter login in my website.
When I click sign in with twitter, it causes 401 error.

    public string WebResponseGet(HttpWebRequest webRequest)
    {
        StreamReader responseReader = null;
        string responseData = "";

        try
        {
            responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
            responseData = responseReader.ReadToEnd();
        }
        catch
        {
            throw;
        }
        finally
        {
            webRequest.GetResponse().GetResponseStream().Close();
            responseReader.Close();
            responseReader = null;
        }

        return responseData;
    }

Stop at this code.
webRequest.GetResponse().GetResponseStream().Close();