Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3305816
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:12:51+00:00 2026-05-17T21:12:51+00:00

I’m using DotNetOpenAuth with a custom login provider to sign users into my site.

  • 0

I’m using DotNetOpenAuth with a custom login provider to sign users into my site. I have most of the code working, but am having an issue returning the view and displaying it so users can log into the provider. Basically, the action is returning an actionresult which is the login page on the specific provider back to the calling javascript. I expected this, as I need to get the login results back to the javascript. Basically, what happens is I get some error about allowing access then three null boxes (look in the return of the call) and then nothing. I need it to goto the provider site and log in.

Data Example: url = https://www.google.com/accounts/o8/id , requiresUserName = false, username = test (assume it was entered into the textbox).

Below is the code:

JavaScript:

function ProviderSignOn(url, requiresUserName) {
    var username = $("#openUserNameText").val();
    if ((requiresUserName == 'True') && (username == '')) {
        clickedProviderUrl = url;
        $('#openUserNameDiv').show('fast');
    }
    else {
        $('#openUserNameDiv').hide('fast');
        $("#openUserNameText").val('');
        $.ajax({
            type: "POST",
            url: "/Account/ProviderSignOn",
            data: "provider=" + url + "&username=" + username,
            success: function (data) {
                alert(data.Error);
                alert(data.Message);
                alert(data.Identifier);
            },
            failure: function (data) {
                alert(data.Error);
                alert(data.Message);
                alert(data.Identifier);
            }
        });
    }
}

Controller Action:

public ActionResult ProviderSignOn(string provider, string username)
    {
        string providerUrl = provider.Replace("{username}", username);
        bool error = true;
        string message = String.Empty;
        string identifier = String.Empty;

        var response = _openId.GetResponse();

        if (response == null)
        {
            Identifier id;

            if (Identifier.TryParse(providerUrl, out id))
            {
                try
                {
                    return _openId.CreateRequest(providerUrl).RedirectingResponse.AsActionResult();
                }
                catch (ProtocolException ex)
                {
                    throw ex;
                }
            }
            else
            {
                error = true;
                message = "Invalid";
                identifier = String.Empty;
            }
        }
        else
        {
            switch (response.Status)
            {
                case AuthenticationStatus.Authenticated:
                    error = false;
                    message = "Success";
                    identifier = response.ClaimedIdentifier;
                    break;
                case AuthenticationStatus.Canceled:
                    error = true;
                    message = "Canceled";
                    identifier = String.Empty;
                    break;
                case AuthenticationStatus.Failed:
                    error = true;
                    message = "Failed";
                    identifier = String.Empty;
                    break;
            }
        }

        return Json(new { Error = error, Message = message, Identifier = identifier });
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:12:52+00:00Added an answer on May 17, 2026 at 9:12 pm

    If I understand your question, you are reaching this line of code:

    return _openId.CreateRequest(providerUrl).RedirectingResponse.AsActionResult();
    

    but then the JavaScript doesn’t know how to deal with the redirect result being returned from the Ajax call.

    In this case, I would say you are returning the wrong thing. Instead, you should probably do something like this:

    return Json(new { RedirectUri = _openId.CreateRequest(providerUrl).RedirectingResponse.Uri });
    

    but I don’t know what kind of object RedirectingResponse is (e.g. does it have any kind of Uri property?). Just providerUrl won’t work, right?

    Anyway, then in your JavaScript you could do

    success: function (data)
    {
        if (data.RedirectUri)
        {
            window.location.href = data.RedirectUri;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.