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... (Zatvorena) (Mono Support )

25453 put(a) pogledan, 7 odgovor(a) 17.6.2011. 14:18:48Kreirao(la) geneboss
geneboss

geneboss

17.6.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
Ovaj sadržaj još nije ocijenjen. 
189 Reputacija 19 Ukupno objava
khorvat

khorvat

17.6.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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
geneboss

geneboss

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

Regards
Ovaj sadržaj još nije ocijenjen. 
189 Reputacija 19 Ukupno objava
Nadir

Nadir

18.6.2011. 0: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
Ovaj sadržaj još nije ocijenjen. 
5 Reputacija 2 Ukupno objava
khorvat

khorvat

18.6.2011. 7: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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
Nadir

Nadir

18.6.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?
Ovaj sadržaj još nije ocijenjen. 
5 Reputacija 2 Ukupno objava
denis

denis

18.6.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/
Ovaj sadržaj još nije ocijenjen. 
7207 Reputacija 956 Ukupno objava