Forms authentication page not called

Discussion in 'ASP .Net' started by R.A.M., Oct 9, 2007.

  1. R.A.M.

    R.A.M. Guest

    Hello,

    I am writing ASP.NET application. I would like to use forms authenication. I
    created Login.aspx page and modified Web.config. Start page is Default.aspx.
    The problem is that Login.aspx is not called.

    Here is part of my Web.config.

    <authentication mode="Forms">

    <forms name="MIM-Magazyn" loginUrl="Login.aspx" />

    </authentication>

    <authorization>

    <deny users="?"/>

    </authorization>

    Please help. I have little experience.
    I use .NET 2.0.
    /RAM/
     
    R.A.M., Oct 9, 2007
    #1
    1. Advertising

  2. R.A.M.

    John Smith Guest

    After <system.web> section you should declare which users have access to
    whish pages.

    Anyone should get to the login page so :

    <location path="Login.aspx">
    <system.web>
    <authorization>
    <allow users="?"/>
    </authorization>
    </system.web>
    </location>

    and no one should get to the default page if not logged in so:

    <location path="Default.aspx">
    <system.web>
    <authorization>
    <deny users="?"/>
    </authorization>
    </system.web>
    </location>

    You don't need <authorization> tag in <system.web> section.

    R.A.M. wrote:
    > Hello,
    >
    > I am writing ASP.NET application. I would like to use forms authenication. I
    > created Login.aspx page and modified Web.config. Start page is Default.aspx.
    > The problem is that Login.aspx is not called.
    >
    > Here is part of my Web.config.
    >
    > <authentication mode="Forms">
    >
    > <forms name="MIM-Magazyn" loginUrl="Login.aspx" />
    >
    > </authentication>
    >
    > <authorization>
    >
    > <deny users="?"/>
    >
    > </authorization>
    >
    > Please help. I have little experience.
    > I use .NET 2.0.
    > /RAM/
    >
    >
     
    John Smith, Oct 9, 2007
    #2
    1. Advertising

  3. R.A.M.

    R.A.M. Guest

    Thanks. Now I have in my Web.config:

    ....



    <location path="Login.aspx">

    <system.web><authorization><allow users="*"/></authorization></system.web>

    </location>

    <location path="Default.aspx">

    <system.web><authorization><deny users="?"/></authorization></system.web>

    </location>

    </configuration>

    The problem is that is receive the following compilation error:

    <location> sections are allowed only within <configuration> sections.
    (F:\Inetpub\wwwroot\MIM-Magazyn\web.config line 81) . I don't understand
    this message because I added <location> within <configuration>.

    Could you help me?

    /RAM/
     
    R.A.M., Oct 9, 2007
    #3
  4. I replied earlier but somehow my reply got lost:

    Defining locations is not necessary. The original code should work.

    Is Login.aspx never called or sometimes it is?



    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "R.A.M." <> wrote in message
    news:fef6j7$3ts$...
    > Hello,
    >
    > I am writing ASP.NET application. I would like to use forms authenication.
    > I created Login.aspx page and modified Web.config. Start page is
    > Default.aspx. The problem is that Login.aspx is not called.
    >
    > Here is part of my Web.config.
    >
    > <authentication mode="Forms">
    >
    > <forms name="MIM-Magazyn" loginUrl="Login.aspx" />
    >
    > </authentication>
    >
    > <authorization>
    >
    > <deny users="?"/>
    >
    > </authorization>
    >
    > Please help. I have little experience.
    > I use .NET 2.0.
    > /RAM/
    >
     
    Eliyahu Goldin, Oct 9, 2007
    #4
  5. R.A.M.

    R.A.M. Guest

    U¿ytkownik "Eliyahu Goldin" <>
    napisa³ w wiadomo¶ci news:u34g6%...
    > Is Login.aspx never called or sometimes it is?


    Never.
    Please help.
    /RAM/
     
    R.A.M., Oct 9, 2007
    #5
  6. Try to change the name parameter in the <forms ...> tag. Could be the cookie
    MIM-Magazyn became persistent on your machine.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "R.A.M." <> wrote in message
    news:feg5ok$ea6$...
    > U¿ytkownik "Eliyahu Goldin" <>
    > napisa³ w wiadomo¶ci news:u34g6%...
    >> Is Login.aspx never called or sometimes it is?

    >
    > Never.
    > Please help.
    > /RAM/
    >
     
    Eliyahu Goldin, Oct 9, 2007
    #6
  7. R.A.M.

    R.A.M. Guest

    U¿ytkownik "Eliyahu Goldin" <>
    napisa³ w wiadomo¶ci news:...
    > Try to change the name parameter in the <forms ...> tag. Could be the
    > cookie MIM-Magazyn became persistent on your machine.


    Thanks.
    It helps, but for one time. After one run of application I must change
    <forms name=...> again to a different string. Do you know what's going on?
    /RAM/
     
    R.A.M., Oct 11, 2007
    #7
  8. By default, the cookie expires after 30 min. If you re-login within 30
    minutes, the login form won't pop up. Look at the "timeout" and
    "slidingExpiration" attributes of the forms element. They control the
    timeout period.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "R.A.M." <> wrote in message
    news:fek16j$5cv$...
    > U¿ytkownik "Eliyahu Goldin" <>
    > napisa³ w wiadomo¶ci news:...
    >> Try to change the name parameter in the <forms ...> tag. Could be the
    >> cookie MIM-Magazyn became persistent on your machine.

    >
    > Thanks.
    > It helps, but for one time. After one run of application I must change
    > <forms name=...> again to a different string. Do you know what's going on?
    > /RAM/
    >
     
    Eliyahu Goldin, Oct 11, 2007
    #8
    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. Eric
    Replies:
    2
    Views:
    1,568
    Tommy
    Feb 13, 2004
  2. JEFF
    Replies:
    1
    Views:
    1,059
    =?Utf-8?B?YnJpYW5zW01DU0Rd?=
    Nov 12, 2007
  3. Keltex
    Replies:
    1
    Views:
    453
    Dominick Baier [DevelopMentor]
    Jan 24, 2006
  4. Eric
    Replies:
    2
    Views:
    648
  5. Replies:
    2
    Views:
    144
Loading...

Share This Page