Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: de0c711abf
Fetching contributors…

Cannot retrieve contributors at this time

47 lines (39 sloc) 1.288 kB
using System.Collections.Specialized;
using System.IO;
using System.Net;
namespace OAuth.Web
{
public class OAuthTokenResponse
{
public OAuthTokenResponse(WebResponse httpWebResponse)
{
using (var stream = httpWebResponse.GetResponseStream())
{
var reader = new StreamReader(stream);
ResponseBody = reader.ReadToEnd();
reader.Close();
}
if (string.IsNullOrEmpty(ResponseBody))
{
return;
}
Items = new NameValueCollection();
foreach (string item in ResponseBody.Split('&'))
{
if (item.IndexOf('=') > -1)
{
string[] temp = item.Split('=');
Items.Add(temp[0], temp[1]);
}
else
{
Items.Add(item, string.Empty);
}
}
Token = new OAuthToken() { Token = Items["oauth_token"], TokenSecret = Items["oauth_token_secret"] };
}
public string ResponseBody { get; private set; }
public NameValueCollection Items { get; private set; }
public OAuthToken Token { get; private set; }
}
}
Jump to Line
Something went wrong with that request. Please try again.