Mono Support Redirect after Login... (Closed)

Viewed 25471 time(s), 7 post(s), 6/17/2011 2:18:48 PM - by geneboss
6/17/2011 2:18:48 PM
189 Reputation 19 Total posts

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

1
6/17/2011 2:36:14 PM
15993 Reputation 2214 Total posts

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

2
6/17/2011 5:01:26 PM
189 Reputation 19 Total posts

Thank you Khorvat,
I'll try it.

Regards

3
6/18/2011 12:58:41 AM
5 Reputation 2 Total posts

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

4
6/18/2011 7:00:00 AM
15993 Reputation 2214 Total posts

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

5
6/18/2011 4:03:24 PM
5 Reputation 2 Total posts

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?

6
6/18/2011 9:30:00 PM
7207 Reputation 956 Total posts

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/

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