Specify page?

Discussion in 'ASP .Net' started by LL, Nov 5, 2003.

  1. LL

    LL Guest

    Hi,

    If the return key does not exist, RedirectFromLoginPage redirects to
    Default.aspx. How to set it up, so if the return key dones not exist, will
    retirect to mypage.aspx?

    Thansk..
    LL, Nov 5, 2003
    #1
    1. Advertising

  2. The only time there is not a redirect page is when the user types in the
    logon page. And, yes, this one has bit me on the butt, as well.

    You can test for the Redirect URL by two means:

    1. FormsAuthentication.GetRedirectUrl
    Will have to have auth cookie set prior to this
    2. Request["ReturnURL"]
    If no URL is set, you can redirect.

    Something like:

    if(FormsAuthentication.Authenticate(name,password))
    {
    if(Request["ReturnURL"] != null)
    {
    FormsAuthentication.RedirectFromLoginPage(name,false);
    }
    else
    {
    FormsAuthentication.GetAuthCookie(name, false);
    Response.Redirect("redirectPage.aspx");
    }

    }
    else
    {
    // TODO: What if user not authenticated
    }

    You will have to tweak this to your use. You will probably want to test for
    redirect URL on first request and set a variable based on this value, as I
    am not sure it will work in the button_click event, as shown. I have not
    tested this code, so it is simply a road map to a potential methodology.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    **********************************************************************
    Think Outside the Box!
    **********************************************************************
    "LL" <> wrote in message
    news:...
    > Hi,
    >
    > If the return key does not exist, RedirectFromLoginPage redirects to
    > Default.aspx. How to set it up, so if the return key dones not exist, will
    > retirect to mypage.aspx?
    >
    > Thansk..
    >
    >
    Cowboy \(Gregory A. Beamer\), Nov 5, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TaeHo Yoo
    Replies:
    2
    Views:
    347
    TaeHo Yoo
    Jul 29, 2003
  2. =?Utf-8?B?TXJNaWtl?=

    Can i specify how much of an aspx page should print?

    =?Utf-8?B?TXJNaWtl?=, Apr 1, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    584
    John Timney \(ASP.NET MVP\)
    Apr 2, 2005
  3. Bryan Ax

    web page Save Dialog specify folder?

    Bryan Ax, May 26, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    402
    Bryan Ax
    May 26, 2005
  4. Matt
    Replies:
    2
    Views:
    469
    Dan Abrey
    Aug 12, 2004
  5. Larry Woods
    Replies:
    16
    Views:
    339
    Aaron [SQL Server MVP]
    Jul 11, 2004
Loading...

Share This Page