/// <summary> /// Perform redirection to the OpenID provider based on the specified identity. /// </summary> /// <param name="identity">The identity or OpenID URL.</param> /// <param name="requiredParameters">The required parameters. Can be null or string.empty.</param> /// <param name="optionalParameters">The optional parameters. Can be null or string.empty.</param> public static bool Login(string identity, string requiredParameters, string optionalParameters) { try { var dic = GetIdentityServer(identity); var server = dic["openid.server"]; var delgate = dic["openid.delegate"] ?? identity; if (!string.IsNullOrEmpty(server)) { string redirectUrl = CreateRedirectUrl(requiredParameters, optionalParameters, delgate, identity); // Add the provided data to session so it can be tracked after authentication var data = new OpenIdData(identity); HttpContext.Current.Session["openid"] = data; HttpContext.Current.Response.Redirect(server + redirectUrl, true); } } catch (Exception) { } return(false); }
/// <summary> /// Perform redirection to the OpenID provider based on the specified identity. /// </summary> /// <param name="identity">The identity or OpenID URL.</param> /// <param name="requiredParameters">The required parameters. Can be null or string.empty.</param> /// <param name="optionalParameters">The optional parameters. Can be null or string.empty.</param> public static bool Login(string identity, string requiredParameters, string optionalParameters) { try { var dic = GetIdentityServer(identity); var server = dic["openid.server"]; var delgate = dic["openid.delegate"] ?? identity; if (!string.IsNullOrEmpty(server)) { string redirectUrl = CreateRedirectUrl(requiredParameters, optionalParameters, delgate, identity); // Add the provided data to session so it can be tracked after authentication var data = new OpenIdData(identity); HttpContext.Current.Session["openid"] = data; HttpContext.Current.Response.Redirect(server + redirectUrl, true); } } catch (Exception) { } return false; }