Log in doesn't go anywhere

Dec 15, 2010 at 4:56 PM

Hi everyone,

I'm going through this tutorial but am stuck at the end of part 7, Membership and Authorization.  I've done all the steps correctly but at the end it says "After logging on with our new Administrator account, we're able to go to the Album Edit screen as before." but when I log in it stays on that page.  If I put in the wrong password I get an error message and I changed the Redirect in the AccountController to go to Google instead of ReturnUrl so I know it's working.  The form is set to submit to "/Account/LogOn?ReturnUrl=%2fStoreManager"

 

Where am I going wrong?

 

Thanks,

Rolando

Dec 16, 2010 at 4:12 AM

Hi Rolando,

I added a LogOnUserControl.ascx file so one can have the ability to log-off once someone is done with their session.

Ex:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%
    if (Request.IsAuthenticated) {
%>
        Welcome <b><%: Page.User.Identity.Name %></b>!
        [ <%: Html.ActionLink("Log Off", "LogOff", "Account") %> ]
<%
    }
    else {
%>
        [ <%: Html.ActionLink("LogOn", "LogOn", "Account") %> ]
<%
    }
%>

Then on the Site.Master file be sure to add something similar to this.

Ex:

<div id="logindisplay">
           <% Html.RenderPartial("LogOnUserControl"); %>
 </div>