HttpUnauthorizedResult

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 anos atrás
I'm troubleshooting where HttpUnauthorizedResult is returned in code called within the shopping cart.

I see that when the shopping cart "Checkout" button from the OrderSummary.cshtml is clicked it calls the "startcheckout" from ShoppingCartController.cs

            if (_workContext.CurrentCustomer.IsGuest())
            {
                if (_orderSettings.AnonymousCheckoutAllowed)
                {
                    return RedirectToRoute("LoginCheckoutAsGuest", new {returnUrl = Url.RouteUrl("ShoppingCart")});
                }
                else
                {
                    return new HttpUnauthorizedResult();
                }
            }

If Annonymous checkout isn't allowed the system returns HttpUnauthorizedResult.  Which I think should take me to the login page but, it doesn't.  Instead I get the error page for "no Web page matching"

Where I get hung up is how the "view" HttpUnauthorizedResult becomes /Account/Login.  For some reason /Account/Login cannot be found when it is called.

Searching through the controllers to try to find information, I can't find an "Account" controller.  However, there is a "Login" controller but, I've noticed if I use the URL /Login works just fine.

How is HttpUnauthorizedResult returning Account/Login?
11 anos atrás
Because it says so in web.config:


    <authentication mode="Forms">
      <forms name="NOPCOMMERCE.AUTH" loginUrl="~/login" protection="All" timeout="43200" path="/" requireSSL="false" slidingExpiration="true" />
    </authentication>
11 anos atrás
Thank you.  I was wondering more how the /Account part of /Account/Login gets in there.  "Account" is not in that file.  If I can find where Account is being put into the URL, maybe I can determine whether or not having my site hosted in a subdirectory is the issue.
11 anos atrás
I just tried to get /Account/Login to change:

<forms name="NOPCOMMERCE.AUTH" loginUrl="asdf" protection="All" timeout="43200" path="/" requireSSL="false" slidingExpiration="true" />

However, I'm still redirected to /Account/Login filenotfound when clicking the checkout button

*  slidingExpiration is true, so the authentication cookie should be refreshed

*  Cleared cache and restarted the application

*  Cleared all Firefox cookies

My loginUrl of "asdf" is still giving me an /Account/Login filenotfound
11 anos atrás
Starting to wonder about my hosting...  I'll keep working this and post any news and hopefully a solution once I get it
11 anos atrás
Here is the fix for my situation and a few for other situations but with the same problem:

http://stackoverflow.com/questions/5009565/asp-net-mvc3-and-windows-auth-on-iis-keeps-redirecting-to-account-login

In RTM try to add to <appSettings> in Web.config:
<add key="enableSimpleMembership" value="false" />
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.