Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Umbraco User's Guide
This is the forum to discuss the Wrox book Umbraco User's Guide by Nik Wahlberg, Paul Sterling; ISBN: 978-0-470-56082-2
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Umbraco User's Guide section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old August 28th, 2013, 02:24 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Login Macro

Hi All -

You can find the Login Macro on Page 244 - 246.

I have a client using Umbraco 4.7.1. They requested a login page for board members. I followed the book: made the required web.config change (DefaultMemberTypeAlias attribute match one of my configured Member types). Then I created the login.ascx page, copied the code from the book on the front end and code behind pages(see below). I compiled, went into Umbraco and created the login Macro, told it to use the .NET User Control Login.ascx. Then I added that Macro to a page. Added a protected page, told the protected page to go to the page with the login macro as a login page. It goes to the correct page, and I can see the control fine. However, nothing happens when I click 'login'. I have a user created. Any guidance would be helpful.

Login.ascx
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Login.ascx.cs" Inherits="LifeSkills.usercontrols.Login" %>
<asp:Login ID="_loginForm" runat="server">
</asp:Login>
Login.ascx.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LifeSkills.usercontrols
{
    public partial class Login : System.Web.UI.UserControl
    {
        //The default redirect page after loggin in
        public int LoginRedirectPage { get; set; }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            _loginForm.LoggedIn += LoginUser_LoggedIn;
        }

        //When the user has successfully authenticated redirect to the specified page
        void LoginUser_LoggedIn(object sender, EventArgs e)
        {
            Response.Redirect(umbraco.library.NiceUrl(LoginRedirectPage));
        }

        protected void Page_Load(object sender, EventArgs e)
        {
        }
    }
}
  #2 (permalink)  
Old August 29th, 2013, 12:28 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Everyone,

I figured out my issue. The previous vender for this client had nested form tags on the master page that was causing no postback on my button click. Found help with this forum: http://our.umbraco.org/forum/core/ge...ontrol-Umbraco
  #3 (permalink)  
Old August 29th, 2013, 02:24 PM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Working but not redirecting

I have the login working now

Now my issue is, though I am logged in, I am still redirected to the login page with the control still there, so I think I still need to log in. I realized that I was logged in when I tried to go to the protected page and it loaded with no error/login page showing.

Is the redirect now working or is it not correct? Shouldn't the "LoginRedirectPage" have a value of my protected page?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot implicitly convert type 'Login' to 'System.Web.UI.WebControls.Login' fh84 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 January 23rd, 2009 11:17 AM
calling to xlam macro from macro inside xlsb SteveB Excel VBA 0 June 30th, 2008 06:43 PM
login failed for user nt authority\anonymous login rj1406 Classic ASP Databases 1 October 24th, 2004 09:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.