views:

47

answers:

0

I have a provider that I'm upgrading from version 2 to version 3. basically a user comes to one of our sites and we say "if you don't have an openID sign up with this one" They click that and are sent to our in house provider what signs them up for an account and has to verify their email address.

In the link I send via Email I included the return to url . This way when they click the link to verify their email (sometimes up to a week later) they are sent to our page that knows to send them back to the returnTo to login.

I could not find a good way to do this in version 2 so I used a hack. Sadly this hack broke in version 2 so I'm completely stumped as to how to find the login page url that is the return_To

Note: I need the full URL not just the domain.

old hack:

if (ProviderEndpoint.PendingAuthenticationRequest != null)
        {
            req =
ProviderEndpoint.PendingAuthenticationRequest.ToString();

            int startpos =  req.LastIndexOf("CheckIdRequest.ReturnTo =
'");
            startpos += "CheckIdRequest.ReturnTo = '".Length;
            int endpos = req.LastIndexOf("token=") - startpos-1;
            if (endpos > 0)
            {
                req = req.Substring(startpos, endpos);
            }
            else
            {
                log.Fatal("Missing token in url" +
ProviderEndpoint.PendingAuthenticationRequest.ToString());
                return "~/";
            }
            req = req.Replace("&internalLogin=True", "");
            req = req.Replace("?internalLogin=True&", "?");
            req = req.Replace("?internalLogin=True", "");
        }