I keep getting
Unable to cast object of type 'System.Security.Principal.GenericPrincipal' to type 'FlyTyingOnline.Models.User'.

here's the relevant Authentication method.

public void OnAuthenticateRequest(object sender, EventArgs e)
        {            
            HttpCookie cookie = Request.Cookies.Get(FormsAuthentication.FormsCookieName);
            
            if (cookie == null)
                return;
           
            int id = GetUserId(cookie);
           
            Models.User current = Models.User.TryFind(id);
           
            if (current == null)
            {
                //This means that we've a cookie for a user that has been removed, we'll
                //remove the cookie and redirect to the default page, if the user will
                //try to log in again, they will get the usual message, and then it is
                //the IT problem.
                RemoveAuthCookieAndRedirectToDefaultPage();
            }
            Context.User = current;            
        }





2006/8/4, hammett < [EMAIL PROTECTED]>:
Yes, you can.

See
http://www.castleproject.org/index.php/MonoRail:FAQ#How_to_handle_authentication_.2F_authorization.3F


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
CastleProject-users mailing list
CastleProject-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/castleproject-users

Reply via email to