How to get "returned url" in Janrain RPX

How to get previous url using JANENN RPX login?

I am using Asp.Net MVC for the request.

+3
source share
1 answer

When an anonymous user views a protected view, asp.net automatically redirects them to the SignIn page and places ReturnUrl in querystring. You can save ReturnUrl by adding it to token_url used in the RPX login.

Here is the helper I created to create the correct href for iframe RPX on my SignIn page:

public static string RpxSignInUrl(this HtmlHelper htmlHelper)
{
    string returnUrl = FormsAuthentication.GetRedirectUrl(
        String.Empty, // userName (not used, but cannot be null)
        false); // persistent cookie (also ignored)

    string tokenUrl = "http://<your-domain>/Account/RpxResponse?ReturnUrl=" +
        HttpUtility.UrlEncode(returnUrl);

    string realm = "<your-app-id>.rpxnow.com";
    string signInUrl = String.Format(
        CultureInfo.InvariantCulture,
        "http://{0}/openid/embed?token_url={1}",
        realm,
        HttpUtility.UrlEncode(tokenUrl));

    return signInUrl;
}

RPX URL-, ReturnUrl. FormsAuthentication.GetRedirectUrl URL-.

, API, Request.Querystring, URL-, , . URL- , asp.net defaultUrl, forms web.config.

+5

Source: https://habr.com/ru/post/1759388/


All Articles