Mono Support First custom page 

Viewed 57586 time(s), 7 post(s), 5/27/2011 9:12:06 PM - by gonzalom
5/27/2011 9:12:06 PM
345 Reputation 38 Total posts

Hi!

I'm trying to build my first custom page.
I think that at least I would need to be able to login so I'd do it as admin an then could access the CMS functionality for adding webparts.
I thought about adding the login webpart from the cathalog, but as I didn't log in yet I can't see the administrative functions!
I'm posting here my aspx code. I would appreciate some guidance.
Thanks,

Gonzalo

<%@ Page Title=""
    Language="C#"
    MasterPageFile="/CustomSite/MasterPages/CustomSite.master"
    AutoEventWireup="true"
    CodeBehind="CustomSiteDefault.aspx.cs"
    Inherits="ProjectName.Web.CustomSite.Pages.CustomSiteDefault" %>
 
<%@ Register TagPrefix="MonoX" TagName="Editor" Src="/MonoX/ModuleGallery/MonoXHtmlEditor.ascx" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">
    <portal:AjaxWebPartManager ID="AjaxWebPartManager1" runat="server">
    </portal:AjaxWebPartManager>
    <div>
        <asp:WebPartZone ID="WebPartZone1" runat="server">
            
        </asp:WebPartZone>
    </div>
    <div>
        <asp:WebPartZone ID="WebPartZone2" runat="server">
 
        </asp:WebPartZone>
    </div>
</asp:Content>

1
5/27/2011 9:51:49 PM
7207 Reputation 956 Total posts

Actually, the login page functionality is one of the last things we usually do on custom projects - you can always use the existing login page for the administration purposes. Note that by default ASP.NET forms authentication is configured to use a page named login.aspx in the root of the site, so you should probably keep the name whatever you do with the design.
As for your code, it appears that you want the login module on the default page of the site? You can have it that way, and you can actually login via the default MonoX functionality until everything else is set up. Hoever, note that usually most of the parts are physically placed in the page markup (look into the code of the existing pages), unless you plan to use drag and drop personalization extensivelly for some reason. It is easier to maintain projects where you can find your way through pages and their controls, compared with pages with empty web part zones where parts are dynamically instantiated.
Something along these lines...

<%@ Register TagPrefix="MonoX" TagName="Login" Src="/MonoX/ModuleGallery/LoginModule.ascx" %>
...
        <asp:WebPartZone ID="WebPartZone1" runat="server">
            <MonoX:Login runat="server" ID="ctlLogin" Width="100%" />
        </asp:WebPartZone>
...
Of course, the login part can now be configured dynamically (using the admin toolbar) or via code.

2
5/30/2011 1:52:30 PM
345 Reputation 38 Total posts

Ok Denis, got it. Thanks.
I could put a login control and have it working. I didn't research about it yet but I wonder how to redirect to another page after login. I suppose the control must expose an event or similar mechanism.
I'd like ask you also if besides the API documentation are there some examples about using Monox API in case I must craft my own functionality.
Thanks again for your valuable help.
Gonzalo

3
5/30/2011 8:30:09 PM
7207 Reputation 956 Total posts

Hi Gonzalo,
Login Web part (Login.ascx) has a parameter DestinationPageUrl that can be used to redirect users to another page after login. If it is not used, a standard behavior is to redirect back to the referring page.
Besides our documentation, the best source for code samples include this forum and our blog. We try to post the real world samples that can be put to use with minimal changes.

4
4/27/2013 3:49:41 AM
103 Reputation 12 Total posts

Denis

I followed your instruction and assigned DestinationPageUrl in the control Page_Load event.  My Control was extending MonoSoftware.MonoX.ModuleGallery.LoginModule .   But after login, its not transferring to the requested page. 

Help is appreciated

5
4/27/2013 6:27:33 PM
7207 Reputation 956 Total posts

So after you log in you are still on the login page? It does not redirect you anywhere?

6
4/27/2013 9:01:56 PM
103 Reputation 12 Total posts

No it will take me to page i requested login. in my case site home page. i want to redirect users to different location based on their role

thanks

7
This is a demo site for MonoX. Please visit Mono Software for more info.