Forms Authentication going back to previous page

Discussion in 'ASP .Net' started by tshad, Jan 31, 2005.

  1. tshad

    tshad Guest

    I have a logon page that is getting the previous page in its return URL
    ("logon.aspx?returnURL=A.aspx") where A.aspx is the page that called B.aspx.
    It should have B.aspx.

    I am calling B.aspx using server.transfer. Could this be causing a problem?

    Thanks,

    Tom
     
    tshad, Jan 31, 2005
    #1
    1. Advertising

  2. Yes, that is the cause of the problem.

    You don't need to use the default RedirectFromLoginPage if you don't want.
    Instead you can use SetAuthCookie and then do a regular Response.Redirect to
    wherever you'd like.
    Here's more information:
    http://authors.aspalliance.com/aspxtreme/sys/Web/Security/FormsAuthenticationClassSetAuthCookie.aspx

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net


    "tshad" <> wrote in message
    news:u1aK1l%...
    >I have a logon page that is getting the previous page in its return URL
    >("logon.aspx?returnURL=A.aspx") where A.aspx is the page that called
    >B.aspx. It should have B.aspx.
    >
    > I am calling B.aspx using server.transfer. Could this be causing a
    > problem?
    >
    > Thanks,
    >
    > Tom
    >
     
    Steve C. Orr [MVP, MCSD], Jan 31, 2005
    #2
    1. Advertising

  3. tshad

    tshad Guest

    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:ORni$o%...
    > Yes, that is the cause of the problem.
    >
    > You don't need to use the default RedirectFromLoginPage if you don't want.
    > Instead you can use SetAuthCookie and then do a regular Response.Redirect
    > to
    > wherever you'd like.
    > Here's more information:
    > http://authors.aspalliance.com/aspxtreme/sys/Web/Security/FormsAuthenticationClassSetAuthCookie.aspx


    That doesn't seem to be my problem. This was working fine before, not sure
    what I did to mess it up.

    I think I partially figured out what is happening.

    I have pages A, B and C and a logon page.

    Page A calls B (server.transfer("B"))

    This should have went to logon as I have forms authentication on. But it
    doesn't and I don't have as a Location in my web.config file.

    Page B calls C (server.transfer("C")) and gets the logon page with B as the
    returnURL (should have been C).

    Tom.
    >
    > "tshad" <> wrote in message
    > news:u1aK1l%...
    >>I have a logon page that is getting the previous page in its return URL
    >>("logon.aspx?returnURL=A.aspx") where A.aspx is the page that called
    >>B.aspx. It should have B.aspx.
    >>
    >> I am calling B.aspx using server.transfer. Could this be causing a
    >> problem?
    >>
    >> Thanks,
    >>
    >> Tom
    >>

    >
    >
     
    tshad, Jan 31, 2005
    #3
  4. Try using Response.Redirect instead of Server.Transfer and see if that fixes
    it.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    "tshad" <> wrote in message
    news:OoXkUz%...
    > "Steve C. Orr [MVP, MCSD]" <> wrote in message
    > news:ORni$o%...
    >> Yes, that is the cause of the problem.
    >>
    >> You don't need to use the default RedirectFromLoginPage if you don't
    >> want.
    >> Instead you can use SetAuthCookie and then do a regular Response.Redirect
    >> to
    >> wherever you'd like.
    >> Here's more information:
    >> http://authors.aspalliance.com/aspxtreme/sys/Web/Security/FormsAuthenticationClassSetAuthCookie.aspx

    >
    > That doesn't seem to be my problem. This was working fine before, not
    > sure what I did to mess it up.
    >
    > I think I partially figured out what is happening.
    >
    > I have pages A, B and C and a logon page.
    >
    > Page A calls B (server.transfer("B"))
    >
    > This should have went to logon as I have forms authentication on. But it
    > doesn't and I don't have as a Location in my web.config file.
    >
    > Page B calls C (server.transfer("C")) and gets the logon page with B as
    > the returnURL (should have been C).
    >
    > Tom.
    >>
    >> "tshad" <> wrote in message
    >> news:u1aK1l%...
    >>>I have a logon page that is getting the previous page in its return URL
    >>>("logon.aspx?returnURL=A.aspx") where A.aspx is the page that called
    >>>B.aspx. It should have B.aspx.
    >>>
    >>> I am calling B.aspx using server.transfer. Could this be causing a
    >>> problem?
    >>>
    >>> Thanks,
    >>>
    >>> Tom
    >>>

    >>
    >>

    >
    >
     
    Steve C. Orr [MVP, MCSD], Feb 1, 2005
    #4
  5. tshad

    tshad Guest

    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:uiRxqI$...
    > Try using Response.Redirect instead of Server.Transfer and see if that
    > fixes it.


    It did.

    I was just reading up on it and it says that Server.Transfer keeps the old
    URL and I assume that was why the returnURL had that page in it.

    This would be a problem, then, if we are concerned with security as we have
    a timeout and expect that if a person waits too long and goes to the next
    page and had used Server.Redirect, it would go to the wrong page.

    I was trying to use Server.Transfer as it was supposed to save resource, but
    this would be a drawback.

    Thanks,

    Tom
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://SteveOrr.net
    >
    >
    > "tshad" <> wrote in message
    > news:OoXkUz%...
    >> "Steve C. Orr [MVP, MCSD]" <> wrote in message
    >> news:ORni$o%...
    >>> Yes, that is the cause of the problem.
    >>>
    >>> You don't need to use the default RedirectFromLoginPage if you don't
    >>> want.
    >>> Instead you can use SetAuthCookie and then do a regular
    >>> Response.Redirect to
    >>> wherever you'd like.
    >>> Here's more information:
    >>> http://authors.aspalliance.com/aspxtreme/sys/Web/Security/FormsAuthenticationClassSetAuthCookie.aspx

    >>
    >> That doesn't seem to be my problem. This was working fine before, not
    >> sure what I did to mess it up.
    >>
    >> I think I partially figured out what is happening.
    >>
    >> I have pages A, B and C and a logon page.
    >>
    >> Page A calls B (server.transfer("B"))
    >>
    >> This should have went to logon as I have forms authentication on. But it
    >> doesn't and I don't have as a Location in my web.config file.
    >>
    >> Page B calls C (server.transfer("C")) and gets the logon page with B as
    >> the returnURL (should have been C).
    >>
    >> Tom.
    >>>
    >>> "tshad" <> wrote in message
    >>> news:u1aK1l%...
    >>>>I have a logon page that is getting the previous page in its return URL
    >>>>("logon.aspx?returnURL=A.aspx") where A.aspx is the page that called
    >>>>B.aspx. It should have B.aspx.
    >>>>
    >>>> I am calling B.aspx using server.transfer. Could this be causing a
    >>>> problem?
    >>>>
    >>>> Thanks,
    >>>>
    >>>> Tom
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
     
    tshad, Feb 1, 2005
    #5
    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. Lauchlan M

    Back to previous page . . .

    Lauchlan M, Aug 19, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,656
    Lauchlan M
    Aug 19, 2003
  2. Eric
    Replies:
    2
    Views:
    1,509
    Tommy
    Feb 13, 2004
  3. Andy Fish
    Replies:
    2
    Views:
    879
    Andy Fish
    Feb 24, 2005
  4. Andy Fish
    Replies:
    0
    Views:
    111
    Andy Fish
    Feb 24, 2005
  5. Eric
    Replies:
    2
    Views:
    575
Loading...

Share This Page