MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Active Directory Authentication Integration  (Mono Support )

Viewed 39420 time(s), 14 post(s) 8/15/2013 5:08:48 PMby erin0201
erin0201

erin0201

8/20/2013 11:14:57 AM
I've been looking through other forum posts on the topic and I saw some references to the Onload events and possibly making your own Login page to be able to override the default redirect url.  I tried to create a login page and once I saved the login control onto the page and then logged out, I could no longer see the login control.  It just disappeared.  It wasn't hidden and the page was set to defaults and viewable by all as was the part. 

Is there anyway to just feed a different redirect URL to the already created login page?  Do you have any samples?  All the default page is good for is a landing page so that if a user logs out, it goes back there.  I just want the login page to drop the user onto the next page once it is confirmed that they are authenticated.

Also, I know you can control who can view pages via the web.config file, but is there a way to control who is even allowed to login/authenticate as well?  Or does it not go that granular?

Thanks!
Erin
This content has not been rated yet. 
453 Reputation 61 Total posts
denis

denis

8/20/2013 4:29:03 PM
I would have to see your code to tell what went wrong. In general, you can try to use the Forms Authentication DefaultURL property to set the URL to which the user is redeirected after login. The approach you mentioned - creating a custom login page that handles the OnLoggedInRedirect event - is even more flexible, as it allows for custom redirection logic based on user's properties. AN additional possibility is to build your own login control by inheriting from MonoX base login, and overriding the RedirectAdterLogin method:

namespace MyProject.WebParts
{
    public partial class LoginModule : MonoSoftware.MonoX.ModuleGallery.LoginModule
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.validationSummaryLogin = ctlLogin.FindControl("validationSummaryLogin") as ValidationSummary;
            this.LoggedInRedirect += new EventHandler<MonoSoftware.Core.CancelEventArgs<MembershipUser>>(LoginModule_LoggedInRedirect);
        }
 
        public override void RedirectAfterLogin()
        {
            if (Roles.IsUserInRole(ctlLogin.UserName, "Users"))
                Response.Redirect("someurl.aspx");
            base.RedirectAfterLogin();
        }
 
        void LoginModule_LoggedInRedirect(object sender, MonoSoftware.Core.CancelEventArgs<MembershipUser> e)
        {
              //do something based on the user data...
        }
    }
}
This content has not been rated yet. 
7207 Reputation 956 Total posts
erin0201

erin0201

8/20/2013 4:36:49 PM
Ok, I am very new to trying to inherit the modules. 
So I can create a page with a cs file backend with the above code even though I don't have access to the source code of the website?  I didn't think I could edit any of the aspx.cs files without having the source code since I'm not able to recompile the website?

If not and I just create my own login page using the Login webpart and have is use the OnLoggedinRedirect event, do you think we could schedule a time for a teamviewer session so that you can help me to try and figure out why the Login web part would disappear off of the page after I logged out?  It sounds like it would be the simplest way to go about things, but for some reason it's not wanting to work for me.

Thanks!
Erin
This content has not been rated yet. 
453 Reputation 61 Total posts
denis

denis

8/20/2013 5:41:13 PM
You can inherit and change a lot of functionality in MonoX, even without the source code (the next major version will bring even better support for customizing its behavior via dependency injection). You will have to set up the Visual Studio project on top of MonoX first:
http://www.mono-software.com/blog/post/Mono/95/Building-a-custom-ASP-NET-project-based-on-MonoX/

We are not providing direct remote support for complex scenarios such as this one for non-priority users, sorry.
This content has not been rated yet. 
7207 Reputation 956 Total posts
1 2