FormsAuthentication.RedirectFromLoginPage And Frames

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default FormsAuthentication.RedirectFromLoginPage And Frames

    Hi!

    I have a page called Login.aspx that handles login (takes username, pass and
    compares to a database). If the user is authenticated,
    FormsAuthentication.RedirectFromLoginPage is called and the page returns to
    the returnUrl. Everything works fine!

    BUT, (theres always a but) if I for some reason decide to put the above site
    inside an iframe tag the page just resets if I type the correct username and
    password. I still get error messages if I typ the wrong one. Exemple:
    <iframe src="http://www.someurl.se/default.aspx">

    Seems like there is a problem with the cookie that is supposed to get set?

    Looking forward to any input into this problem.


    Thanks!
    Johan Karlsson




    Johan Karlsson Guest

  2. Similar Questions and Discussions

    1. Problem with FormsAuthentication.RedirectFromLoginPage
      I am having problem with redirection from http-https-http First an http application gets redirected to https application for authentication...
    2. RedirectFromLoginPage fails
      I am trying to implement the classic ASP.NET FormsAuthentication model for a website. The behavior of the website is normal until the login.aspx...
    3. RedirectFromLoginPage not redirecting
      I'm attempting to use Forms/Roles based authentication and authorization. A subdirectory's web.config allows only "Admin" roles and it does kick...
    4. FormsAuthentication.RedirectFromLoginPage is not passed fully qualified url
      I have two web applications on the same server: http://localhost/ModemUpgrade and http://localhost/TestFormAuth The web.config of...
    5. System.Web.Security.FormsAuthentication.RedirectFromLoginPage is not working..
      Thanks in advance, What I did was 1. add these lines in web.cofig file <authentication mode="Forms"> <forms name="frmAuthentication"...
  3. #2

    Default Re: FormsAuthentication.RedirectFromLoginPage And Frames

    > BUT, (theres always a but) if I for some reason decide to put the above
    > site inside an iframe tag the page just resets if I type the correct
    > username and
    YES!, There is always a BUT if you use frames.

    ;-)

    Do you handle the AuthenticateRequests somehow?

    --
    Daniel Fisher(lennybacon)
    MCP ASP.NET C#
    Blog: [url]http://www.lennybacon.com/[/url]


    "Johan Karlsson" <johan.no.spam.karlsson@adnome.no.spam.se> wrote in message
    news:OP%23um4S$EHA.3820@TK2MSFTNGP11.phx.gbl...
    > Hi!
    >
    > I have a page called Login.aspx that handles login (takes username, pass
    > and compares to a database). If the user is authenticated,
    > FormsAuthentication.RedirectFromLoginPage is called and the page returns
    > to the returnUrl. Everything works fine!
    >
    > BUT, (theres always a but) if I for some reason decide to put the above
    > site inside an iframe tag the page just resets if I type the correct
    > username and password. I still get error messages if I typ the wrong one.
    > Exemple: <iframe src="http://www.someurl.se/default.aspx">
    >
    > Seems like there is a problem with the cookie that is supposed to get set?
    >
    > Looking forward to any input into this problem.
    >
    >
    > Thanks!
    > Johan Karlsson
    >
    >
    >
    >

    Daniel Fisher\(lennybacon\) Guest

  4. #3

    Default Re: FormsAuthentication.RedirectFromLoginPage And Frames

    Hi!

    If I decided the frame would go, but the customers cms must have my part
    inside of a frame so I don't have a choice. :(

    The page is divided into 2 sections where the top frame only contains a
    logotype and the bottom half the original system.

    If I handle the AuthenticateRequests? I must say that I'm no security expert
    so I only did what it says in the books. (the easy examples :) )

    That is:

    1) Get user and pass
    2) Verify if valid or not
    3) If valid, call FormsAuthentication.RedirectFromLoginPage(u.Login, False)

    As stated before, this works in an "unframed environment". What is the
    difference when running inside a frame comparing to a top level window?

    I'm sure that the behavior has some very logical explanation and I'm really
    curios to find out what it is.

    Thanks!
    /Johan


    "Daniel Fisher(lennybacon)" <info@(removethis)lennybacon.com> wrote in
    message news:%23n1ml0W$EHA.3824@TK2MSFTNGP10.phx.gbl...
    >> BUT, (theres always a but) if I for some reason decide to put the above
    >> site inside an iframe tag the page just resets if I type the correct
    >> username and
    >
    > YES!, There is always a BUT if you use frames.
    >
    > ;-)
    >
    > Do you handle the AuthenticateRequests somehow?
    >
    > --
    > Daniel Fisher(lennybacon)
    > MCP ASP.NET C#
    > Blog: [url]http://www.lennybacon.com/[/url]
    >
    >
    > "Johan Karlsson" <johan.no.spam.karlsson@adnome.no.spam.se> wrote in
    > message news:OP%23um4S$EHA.3820@TK2MSFTNGP11.phx.gbl...
    >> Hi!
    >>
    >> I have a page called Login.aspx that handles login (takes username, pass
    >> and compares to a database). If the user is authenticated,
    >> FormsAuthentication.RedirectFromLoginPage is called and the page returns
    >> to the returnUrl. Everything works fine!
    >>
    >> BUT, (theres always a but) if I for some reason decide to put the above
    >> site inside an iframe tag the page just resets if I type the correct
    >> username and password. I still get error messages if I typ the wrong one.
    >> Exemple: <iframe src="http://www.someurl.se/default.aspx">
    >>
    >> Seems like there is a problem with the cookie that is supposed to get
    >> set?
    >>
    >> Looking forward to any input into this problem.
    >>
    >>
    >> Thanks!
    >> Johan Karlsson
    >>
    >>
    >>
    >>
    >
    >

    Johan Karlsson Guest

  5. #4

    Default Re: FormsAuthentication.RedirectFromLoginPage And Frames

    You must assigen the IPricipal in the OnAuthenticateRequest Method
    (Global.asax).

    --
    Daniel Fisher(lennybacon)
    MCP ASP.NET C#
    Blog: [url]http://www.lennybacon.com/[/url]


    "Johan Karlsson" <johan.no.spam.karlsson@adnome.no.spam.se> wrote in message
    news:%23PmY5df$EHA.1604@TK2MSFTNGP12.phx.gbl...
    > Hi!
    >
    > If I decided the frame would go, but the customers cms must have my part
    > inside of a frame so I don't have a choice. :(
    >
    > The page is divided into 2 sections where the top frame only contains a
    > logotype and the bottom half the original system.
    >
    > If I handle the AuthenticateRequests? I must say that I'm no security
    > expert so I only did what it says in the books. (the easy examples :) )
    >
    > That is:
    >
    > 1) Get user and pass
    > 2) Verify if valid or not
    > 3) If valid, call FormsAuthentication.RedirectFromLoginPage(u.Login,
    > False)
    >
    > As stated before, this works in an "unframed environment". What is the
    > difference when running inside a frame comparing to a top level window?
    >
    > I'm sure that the behavior has some very logical explanation and I'm
    > really curios to find out what it is.
    >
    > Thanks!
    > /Johan
    >
    >
    > "Daniel Fisher(lennybacon)" <info@(removethis)lennybacon.com> wrote in
    > message news:%23n1ml0W$EHA.3824@TK2MSFTNGP10.phx.gbl...
    >>> BUT, (theres always a but) if I for some reason decide to put the above
    >>> site inside an iframe tag the page just resets if I type the correct
    >>> username and
    >>
    >> YES!, There is always a BUT if you use frames.
    >>
    >> ;-)
    >>
    >> Do you handle the AuthenticateRequests somehow?
    >>
    >> --
    >> Daniel Fisher(lennybacon)
    >> MCP ASP.NET C#
    >> Blog: [url]http://www.lennybacon.com/[/url]
    >>
    >>
    >> "Johan Karlsson" <johan.no.spam.karlsson@adnome.no.spam.se> wrote in
    >> message news:OP%23um4S$EHA.3820@TK2MSFTNGP11.phx.gbl...
    >>> Hi!
    >>>
    >>> I have a page called Login.aspx that handles login (takes username, pass
    >>> and compares to a database). If the user is authenticated,
    >>> FormsAuthentication.RedirectFromLoginPage is called and the page returns
    >>> to the returnUrl. Everything works fine!
    >>>
    >>> BUT, (theres always a but) if I for some reason decide to put the above
    >>> site inside an iframe tag the page just resets if I type the correct
    >>> username and password. I still get error messages if I typ the wrong
    >>> one. Exemple: <iframe src="http://www.someurl.se/default.aspx">
    >>>
    >>> Seems like there is a problem with the cookie that is supposed to get
    >>> set?
    >>>
    >>> Looking forward to any input into this problem.
    >>>
    >>>
    >>> Thanks!
    >>> Johan Karlsson
    >>>
    >>>
    >>>
    >>>
    >>
    >>
    >
    >

    Daniel Fisher\(lennybacon\) Guest

  6. #5

    Default Re: FormsAuthentication.RedirectFromLoginPage And Frames

    Hi!

    Could you give an example? Does this cause the behavior that is doesn't work
    in frames but do work outside of frames?

    Thanks
    /Johan

    "Daniel Fisher(lennybacon)" <info@(removethis)lennybacon.com> wrote in
    message news:%23AEWevtBFHA.208@TK2MSFTNGP12.phx.gbl...
    > You must assigen the IPricipal in the OnAuthenticateRequest Method
    > (Global.asax).
    >
    > --
    > Daniel Fisher(lennybacon)
    > MCP ASP.NET C#
    > Blog: [url]http://www.lennybacon.com/[/url]
    >
    >
    > "Johan Karlsson" <johan.no.spam.karlsson@adnome.no.spam.se> wrote in
    > message news:%23PmY5df$EHA.1604@TK2MSFTNGP12.phx.gbl...
    >> Hi!
    >>
    >> If I decided the frame would go, but the customers cms must have my part
    >> inside of a frame so I don't have a choice. :(
    >>
    >> The page is divided into 2 sections where the top frame only contains a
    >> logotype and the bottom half the original system.
    >>
    >> If I handle the AuthenticateRequests? I must say that I'm no security
    >> expert so I only did what it says in the books. (the easy examples :) )
    >>
    >> That is:
    >>
    >> 1) Get user and pass
    >> 2) Verify if valid or not
    >> 3) If valid, call FormsAuthentication.RedirectFromLoginPage(u.Login,
    >> False)
    >>
    >> As stated before, this works in an "unframed environment". What is the
    >> difference when running inside a frame comparing to a top level window?
    >>
    >> I'm sure that the behavior has some very logical explanation and I'm
    >> really curios to find out what it is.
    >>
    >> Thanks!
    >> /Johan
    >>
    >>
    >> "Daniel Fisher(lennybacon)" <info@(removethis)lennybacon.com> wrote in
    >> message news:%23n1ml0W$EHA.3824@TK2MSFTNGP10.phx.gbl...
    >>>> BUT, (theres always a but) if I for some reason decide to put the above
    >>>> site inside an iframe tag the page just resets if I type the correct
    >>>> username and
    >>>
    >>> YES!, There is always a BUT if you use frames.
    >>>
    >>> ;-)
    >>>
    >>> Do you handle the AuthenticateRequests somehow?
    >>>
    >>> --
    >>> Daniel Fisher(lennybacon)
    >>> MCP ASP.NET C#
    >>> Blog: [url]http://www.lennybacon.com/[/url]
    >>>
    >>>
    >>> "Johan Karlsson" <johan.no.spam.karlsson@adnome.no.spam.se> wrote in
    >>> message news:OP%23um4S$EHA.3820@TK2MSFTNGP11.phx.gbl...
    >>>> Hi!
    >>>>
    >>>> I have a page called Login.aspx that handles login (takes username,
    >>>> pass and compares to a database). If the user is authenticated,
    >>>> FormsAuthentication.RedirectFromLoginPage is called and the page
    >>>> returns to the returnUrl. Everything works fine!
    >>>>
    >>>> BUT, (theres always a but) if I for some reason decide to put the above
    >>>> site inside an iframe tag the page just resets if I type the correct
    >>>> username and password. I still get error messages if I typ the wrong
    >>>> one. Exemple: <iframe src="http://www.someurl.se/default.aspx">
    >>>>
    >>>> Seems like there is a problem with the cookie that is supposed to get
    >>>> set?
    >>>>
    >>>> Looking forward to any input into this problem.
    >>>>
    >>>>
    >>>> Thanks!
    >>>> Johan Karlsson
    >>>>
    >>>>
    >>>>
    >>>>
    >>>
    >>>
    >>
    >>
    >
    >

    Johan Karlsson Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139