0

I have a checkout process that lets users add items to cart, and they are able to go through the first step of the checkout before logging in. Once it gets to the part where they have to log in, I'd like to use a popup div for this rather than redirecting them to a login page so it doesn't feel like they're leaving the checkout process.

I'm not sure what the best way to implement this is though. In a perfect world, there would be a way to integrate this idea with the existing asp.net forms authentication and it would popup the div over the page you're already on before redirecting to the protected page. I don't 'think' that's possible though so wondering how else could I do this?

BVernon
  • 3,205
  • 5
  • 28
  • 64

1 Answers1

0

There are a variety of ways to skin this cat. If you are a bit more old school, you can use the AJAX bits and modal popup control extender. If you are not using the AJAX bits for anything else, I would not go this direction.

A newer approach would be something like a JQuery popup: http://www.formget.com/jquery-popup-form/

As JQuery is integrated with ASP.NET now, this is a much more modern approach.

The key here is making the call outside of the page context, which means JavaScript (AJAX is essentially JavaScript (and XML - as the name implies)). You then can bring the user's context into play without sending to a login page and then bringing them back to the cart checkout page.

There are other JavaScript libraries that can be used for the same purpose. I would google login popup JQuery (or other library) and you will likely find a full implementation somewhere and save yourself time inventing it.

Gregory A Beamer
  • 16,870
  • 3
  • 25
  • 32
  • So I don't have any issue with using ajax, jQuery, or whatever... the project uses all this and I have access to the Kendo UI as well. The part I'm confused on isn't so much how to make a popup div as much as how will I hook it into the authentication process so that it knows to popup before going to a protected page? – BVernon Feb 25 '15 at 17:49
  • I think you were half trying to answer that question in your second to last paragraph... maybe you could expound on any idea you have about how you'd go about doing that? – BVernon Feb 25 '15 at 17:52
  • To understand the problem, you have to understand how websites work. It is a stateless one answer at a time type of conversation that is kludged by different means, like cookies, to appear stateful. In your case, the easiest way is to have the popup any time a user is not signed in. Once he signs in, you will not popup. So have the popup refresh the page he is on is one option,as the next GET will have the proper authentication "cookie" (this is server cookies, not user cookies). The mechanics really depend on the business need, however. – Gregory A Beamer Feb 25 '15 at 18:15
  • You could have something similar to this: http://stackoverflow.com/questions/13117054/how-to-authenticate-username-password-in-jquery-with-asp-net – Gregory A Beamer Feb 25 '15 at 18:15