El usuario de sesión no se registra utilizando el proveedor de membresía de asp.net mvc c #

I have the Checkout form, that let the user check out there quote when they are success log in. This is a part of my action:

[Authorize]
    public JsonResult ConfirmCheckout(string id)
    {
      .......
    }

Este es mi LogonCustomer acción:

 [HttpPost]
    public ActionResult LogOnCustomer(LogOnModel model, string returnUrl, FormCollection frm)
    {  
        if (ModelState.IsValid)
        { 
            if (MembershipService.ValidateCustomer(model.UserName, model.Password))
            {
                this.AuthCustomer = MembershipService.AuthCustomer;
                 if (!String.IsNullOrEmpty(returnUrl))
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    //tesing whether the password of the user is number 
                    if (HelperClass.IsStrongPassword(model.Password) == false) 
                    {
                        return Redirect(@"~/Account/ChangeDefaultPassword?"+model.UserName);

                    }else{
                        FormsService.SignIn(model.UserName, model.RememberMe);
                        return RedirectToAction("RedirectPage", "Account");
                    }
                }
            }
         }

When user click the link to /Quotation/Checkout/, the user have to log in with the valid user name and password. Problem : When the user fill in the valid user name and valid password, they still on the Logon form, Not go to the '/Quotation/Checkout'.

Could anyone solve this problem for me? Thanks you and waiting to your response.

preguntado el 01 de febrero de 12 a las 03:02

1 Respuestas

That's because you need to have your returnUrl populated in your ActionLink() that the user clicks on.

Por ejemplo:

@Html.ActionLink("Log On", "LogOnCustomer", "YourControllerName", new { returnUrl = Request.Url }, null)

Respondido 01 Feb 12, 08:02

This is what I have been tried <% string checkouturl = Url.Action("Checkout", "Quotation", new { returnUrl = Request.Url }); %> <a id ="acheckoutb" href='<%: checkouturl %>'> <img id ="imgcheckoutb" src="checkout.gif" border="0" width="80px;" alt="Check-out"/> </a> But it still not work. - titi

I tried that, But it after log in, it is redirect to the page that I put this link. - titi

@titi Is that not what you want?? - user596075

yes, I want it to redirect to the path '/Quotation/ConfirmCheckout'. But although I put the redirect link to this action, It still come to the log in page again. I think because of the [Authorized] problem, When I output this.HttpContext.User.Identity.IsAuthenticated en el bloque MembershipService.ValidateCustomer method, it is false. - titi

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.