daily pastebin goal
35%
SHARE
TWEET

Untitled

a guest Feb 12th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. protected void FuncOpenID()
  2.     {
  3.         OpenIdRelyingParty OIDRP = new OpenIdRelyingParty();
  4.         var response = OIDRP.GetResponse();
  5.         if (response != null)
  6.         {
  7.             switch (response.Status)
  8.             {
  9.                 case AuthenticationStatus.Authenticated:
  10.  
  11.                     var fetchResponse = response.GetExtension<FetchResponse>();
  12.                     Session["GoogleIdentifier"] = fetchResponse;
  13.                     var Testresponse = Session["GoogleIdentifier"] as FetchResponse;
  14.  
  15.                     GlobalData.Email = Testresponse.GetAttributeValue(WellKnownAttributes.Contact.Email) ;
  16.                     //GlobalData.Name = Testresponse.GetAttributeValue(WellKnownAttributes.Name.First) ;
  17.                     //GlobalData.LastName = Testresponse.GetAttributeValue(WellKnownAttributes.Name.Last);
  18.                     Session["U_Email"] = Testresponse.GetAttributeValue(WellKnownAttributes.Contact.Email);
  19.                     Session["U_Name"] = Testresponse.GetAttributeValue(WellKnownAttributes.Name.First);
  20.                     Session["U_LastName"] = Testresponse.GetAttributeValue(WellKnownAttributes.Name.Last);
  21.                     FormsAuthentication.RedirectFromLoginPage(GlobalData.Email, false);   //(response.ClaimedIdentifier, false);
  22.                     FormsAuthentication.RedirectFromLoginPage(GlobalData.Name, false);
  23.                     FormsAuthentication.RedirectFromLoginPage(GlobalData.LastName, false);
  24.                     break;
  25.                 case AuthenticationStatus.Canceled:
  26.                     break;
  27.                 case AuthenticationStatus.Failed:
  28.                     break;
  29.             }
  30.         }
  31.     }
  32.  
  33.  
  34.  
  35.     protected void OpenLogin_Click(object src, CommandEventArgs e)
  36.     {
  37.         string StrUri = e.CommandArgument.ToString();
  38.         OpenIdRelyingParty openid = new OpenIdRelyingParty();
  39.         var b = new UriBuilder(Request.Url) { Query = "" };
  40.  
  41.         var req = openid.CreateRequest(StrUri);
  42.  
  43.         var fetchRequest = new FetchRequest();
  44.         fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
  45.         fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.First);
  46.         fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Last);
  47.  
  48.         req.AddExtension(fetchRequest);
  49.  
  50.         req.RedirectToProvider();
  51.  
  52.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top