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.

First custom page  (Mono Support )

Viewed 54560 time(s), 7 post(s) 5/27/2011 9:12:06 PMby gonzalom

Related topics

gonzalom

gonzalom

5/27/2011 9:12:06 PM
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>
This content has not been rated yet. 
345 Reputation 38 Total posts
denis

denis

5/27/2011 9:51:49 PM
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.

This content has not been rated yet. 
7207 Reputation 956 Total posts
gonzalom

gonzalom

5/30/2011 1:52:30 PM
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
This content has not been rated yet. 
345 Reputation 38 Total posts
denis

denis

5/30/2011 8:30:09 PM
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.
This content has not been rated yet. 
7207 Reputation 956 Total posts
mrudul

mrudul

4/27/2013 3:49:41 AM
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
This content has not been rated yet. 
103 Reputation 12 Total posts
denis

denis

4/27/2013 6:27:33 PM
So after you log in you are still on the login page? It does not redirect you anywhere?
This content has not been rated yet. 
7207 Reputation 956 Total posts
mrudul

mrudul

4/27/2013 9:01:56 PM
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
This content has not been rated yet. 
103 Reputation 12 Total posts