diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-05-13 20:35:00 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-05-13 20:35:00 -0700 |
commit | b9f5a2bddfb925c308904cc855eb8d02e5c361bf (patch) | |
tree | a5706cda0a6822ccae067b345f7928ccd006ae62 /samples/OAuthConsumer/Facebook.aspx.cs | |
parent | 91b551a888d3cae98cf5f1053c6f5c7141db4a3f (diff) | |
download | DotNetOpenAuth-b9f5a2bddfb925c308904cc855eb8d02e5c361bf.zip DotNetOpenAuth-b9f5a2bddfb925c308904cc855eb8d02e5c361bf.tar.gz DotNetOpenAuth-b9f5a2bddfb925c308904cc855eb8d02e5c361bf.tar.bz2 |
Placeholder Facebook Graph API now in the ApplicationBlock, and the sample calls into it.
Diffstat (limited to 'samples/OAuthConsumer/Facebook.aspx.cs')
-rw-r--r-- | samples/OAuthConsumer/Facebook.aspx.cs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/samples/OAuthConsumer/Facebook.aspx.cs b/samples/OAuthConsumer/Facebook.aspx.cs index 3553f0e..ce191fd 100644 --- a/samples/OAuthConsumer/Facebook.aspx.cs +++ b/samples/OAuthConsumer/Facebook.aspx.cs @@ -1,15 +1,10 @@ namespace OAuthConsumer { using System; - using System.Collections.Generic; using System.Configuration; - using System.IO; - using System.Linq; using System.Net; using System.Web; - using System.Web.Script.Serialization; - using System.Web.UI; - using System.Web.UI.WebControls; using DotNetOpenAuth.ApplicationBlock; + using DotNetOpenAuth.ApplicationBlock.Facebook; using DotNetOpenAuth.OAuthWrap; public partial class Facebook : System.Web.UI.Page { @@ -26,11 +21,11 @@ } else { var request = WebRequest.Create("https://graph.facebook.com/me?access_token=" + Uri.EscapeDataString(authorization.AccessToken)); using (var response = request.GetResponse()) { - using (var responseReader = new StreamReader(response.GetResponseStream())) { - string data = responseReader.ReadToEnd(); + using (var responseStream = response.GetResponseStream()) { + var graph = FacebookGraph.Deserialize(responseStream); + nameLabel.Text = HttpUtility.HtmlEncode(graph.Name); } } - nameLabel.Text = "Success! Access token: " + HttpUtility.HtmlEncode(authorization.AccessToken); } } } |