summaryrefslogtreecommitdiffstats
path: root/samples/OAuthClient/SignInWithTwitter.aspx.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2010-07-31 22:01:16 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2010-07-31 22:01:16 -0700
commitc94c7f8197eda673947a9d1e0c0b3f3c4efca94f (patch)
tree0f978cfc2de70c54ac81e11d4339da04dff9f27f /samples/OAuthClient/SignInWithTwitter.aspx.cs
parent7d38eefb65928a1e80036ec006b0e129dc2cface (diff)
downloadDotNetOpenAuth-c94c7f8197eda673947a9d1e0c0b3f3c4efca94f.zip
DotNetOpenAuth-c94c7f8197eda673947a9d1e0c0b3f3c4efca94f.tar.gz
DotNetOpenAuth-c94c7f8197eda673947a9d1e0c0b3f3c4efca94f.tar.bz2
Split the OAuthServiceProvider sample into two samples: OAuthAuthorizationServer and OAuthResourceServer.
Renamed OAuthConsumer to OAuthClient.
Diffstat (limited to 'samples/OAuthClient/SignInWithTwitter.aspx.cs')
-rw-r--r--samples/OAuthClient/SignInWithTwitter.aspx.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/samples/OAuthClient/SignInWithTwitter.aspx.cs b/samples/OAuthClient/SignInWithTwitter.aspx.cs
new file mode 100644
index 0000000..04b302c
--- /dev/null
+++ b/samples/OAuthClient/SignInWithTwitter.aspx.cs
@@ -0,0 +1,39 @@
+namespace OAuthClient {
+ using System;
+ using System.Collections.Generic;
+ using System.Configuration;
+ using System.Linq;
+ using System.Web;
+ using System.Web.Security;
+ using System.Web.UI;
+ using System.Web.UI.WebControls;
+ using System.Xml.Linq;
+ using System.Xml.XPath;
+ using DotNetOpenAuth.ApplicationBlock;
+ using DotNetOpenAuth.OAuth;
+
+ public partial class SignInWithTwitter : System.Web.UI.Page {
+ protected void Page_Load(object sender, EventArgs e) {
+ if (TwitterConsumer.IsTwitterConsumerConfigured) {
+ this.MultiView1.ActiveViewIndex = 1;
+
+ if (!IsPostBack) {
+ string screenName;
+ int userId;
+ if (TwitterConsumer.TryFinishSignInWithTwitter(out screenName, out userId)) {
+ this.loggedInPanel.Visible = true;
+ this.loggedInName.Text = screenName;
+
+ // In a real app, the Twitter username would likely be used
+ // to log the user into the application.
+ ////FormsAuthentication.RedirectFromLoginPage(screenName, false);
+ }
+ }
+ }
+ }
+
+ protected void signInButton_Click(object sender, ImageClickEventArgs e) {
+ TwitterConsumer.StartSignInWithTwitter(this.forceLoginCheckbox.Checked).Send();
+ }
+ }
+} \ No newline at end of file