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.

Redirect after Login... (Closed) (Mono Support )

Viewed 24636 time(s), 7 post(s) 6/17/2011 2:18:48 PMby geneboss
geneboss

geneboss

6/17/2011 2:18:48 PM
Hi Guys,
I want to redirect user after logging in. I'm thinking to do the following:

private string _returnURL = string.Empty;
protected void RedirectAfterLogin(object sender, EventArgs e)
{
if(_returnURL != string.Empty)
Response.Redirect("/MonoX/Pages/SocialNetworking/Dashboard.aspx");
}

Would you kindly elaborate on this, since you indicated RedirectAfterLogin is obfuscated and can not be translated


Thanks
This content has not been rated yet. 
189 Reputation 19 Total posts
khorvat

khorvat

6/17/2011 2:36:14 PM
Hi,

  here is a MonoX sample code so you can check the underneath functionality.

/// <summary>
/// Redirects the request after the successful login.
/// </summary>
public virtual void RedirectAfterLogin()
{
    //redirect to home if there is no ReturnUrl
    if (String.IsNullOrEmpty(FormsAuthentication.DefaultUrl) && String.IsNullOrEmpty(ctlLogin.DestinationPageUrl) && Page.Request["ReturnUrl"] == null)
        Response.Redirect("/");
    //do not redirect to message page as it will show the empty text
    if (!string.IsNullOrEmpty(Request["ReturnUrl"]) && String.Equals(Request["ReturnUrl"], MonoSoftware.Web.UrlFormatter.ResolveUrl(ApplicationSettings.MessagePageUrl), StringComparison.CurrentCultureIgnoreCase))
        Response.Redirect("/");
 
    //otherwise the request will be redirected to the address stored in the ReturnUrl parameter
}

I hope that this clears a bit what is going on inside that method and if you override the method now you will know what you have disabled. 

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
geneboss

geneboss

6/17/2011 5:01:26 PM
Thank you Khorvat,
I'll try it.

Regards
This content has not been rated yet. 
189 Reputation 19 Total posts
Nadir

Nadir

6/18/2011 12:58:41 AM
hello,
I am not really a programmer. I tried to use your code, but can not make it work. it is asking me for missing references.
Can you please tell me what I am missing?

Thank you very much
This content has not been rated yet. 
5 Reputation 2 Total posts
khorvat

khorvat

6/18/2011 7:00:00 AM
Hi,

  can you tell me what references are you referring to ? 

Note: You need to have the following references inside your custom project to be able to work with MonoX:


MonoSoftware.Core
MonoSoftware.LLBLGen
MonoSoftware.Web
MonoSoftware.Web.LiteGrid
MonoSoftware.Web.Pager
MonoSoftware.Web.Workspace
MonoX

You can find all of these assemblies inside the MonoX bin folder.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts
Nadir

Nadir

6/18/2011 4:03:24 PM
hello khorvat,
thank you for getting back to me.
actually I'm trying to make this work inside the current monox application. but i'm not sure if i'm doing it right. here is what i did:
I created a new page called login.aspx.cs and placed in Monox. like the following:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MonoSoftware.Core;
using MonoSoftware.Web.Security;
using MonoSoftware.MonoX.Pages;
 
/// <summary>
/// Summary description for Login
/// </summary>
public class Login
{
    /// <summary>
    /// Redirects the request after the successful login.
    /// </summary>
    public virtual void RedirectAfterLogin()
    {
        //redirect to home if there is no ReturnUrl
        if (String.IsNullOrEmpty(FormsAuthentication.DefaultUrl) && String.IsNullOrEmpty(ctlLogin.DestinationPageUrl) && Page.Request["ReturnUrl"] == null)
            Response.Redirect("/");
        //do not redirect to message page as it will show the empty text
        if (!string.IsNullOrEmpty(Request["ReturnUrl"]) && String.Equals(Request["ReturnUrl"], MonoSoftware.Web.UrlFormatter.ResolveUrl(ApplicationSettings.MessagePageUrl), StringComparison.CurrentCultureIgnoreCase))
            Response.Redirect("/");
 
        //otherwise the request will be redirected to the address stored in the ReturnUrl parameter
    }
 
}
but I get errors indicated in bold. As I said, I'm not a programmer So this may seem foolish to you. I'm sure there is a procedure to do this in monox no?
This content has not been rated yet. 
5 Reputation 2 Total posts
denis

denis

6/18/2011 9:30:00 PM
Hi Nadir,
It will not work that way - you will have to posses a minimal level of knowledge about programming in ASP.NET. There is an elaborate article on this site that explains how to open a custom project: http://www.mono-software.com/blog/post/Mono/95/Building-a-custom-ASP-NET-project-based-on-MonoX/
This content has not been rated yet. 
7207 Reputation 956 Total posts