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 25609 time(s), 7 post(s) 17.06.2011 14:18:48by geneboss
geneboss

geneboss

17.06.2011 14:18:48
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
Dieser Inhalt wurde noch nicht bewertet. 
189 Reputation 19 Total posts
khorvat

khorvat

17.06.2011 14:36:14
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
Dieser Inhalt wurde noch nicht bewertet. 
15993 Reputation 2214 Total posts
geneboss

geneboss

17.06.2011 17:01:26
Thank you Khorvat,
I'll try it.

Regards
Dieser Inhalt wurde noch nicht bewertet. 
189 Reputation 19 Total posts
Nadir

Nadir

18.06.2011 00:58:41
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
Dieser Inhalt wurde noch nicht bewertet. 
5 Reputation 2 Total posts
khorvat

khorvat

18.06.2011 07:00:00
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
Dieser Inhalt wurde noch nicht bewertet. 
15993 Reputation 2214 Total posts
Nadir

Nadir

18.06.2011 16:03:24
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?
Dieser Inhalt wurde noch nicht bewertet. 
5 Reputation 2 Total posts
denis

denis

18.06.2011 21:30:00
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/
Dieser Inhalt wurde noch nicht bewertet. 
7207 Reputation 956 Total posts