Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem with Form based authentication

Problem with Form based authentication

Scheduled Pinned Locked Moved ASP.NET
securityhelpquestionworkspace
6 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Maxdd 7
    wrote on last edited by
    #1

    I've the following on my web.config file:

    <authentication mode= "Forms">
    <forms name=".ASPXFORMSDEMO" loginUrl="login.aspx"
    protection="All" path="/" timeout="30" />
    </authentication>
    </system.web>

    <!-- Require authorization for all files -->
    <!-- in the "member" subdirectory        -->
    

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

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

    This last section (path="images") its because not authorized users need to access image files so they can load login.aspx. However, with this configuration, unauthorized users can access others .aspx, they are not redirect to login.aspx. They are allowed to access anywhere. Why is it happening?

    S A 2 Replies Last reply
    0
    • M Maxdd 7

      I've the following on my web.config file:

      <authentication mode= "Forms">
      <forms name=".ASPXFORMSDEMO" loginUrl="login.aspx"
      protection="All" path="/" timeout="30" />
      </authentication>
      </system.web>

      <!-- Require authorization for all files -->
      <!-- in the "member" subdirectory        -->
      

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

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

      This last section (path="images") its because not authorized users need to access image files so they can load login.aspx. However, with this configuration, unauthorized users can access others .aspx, they are not redirect to login.aspx. They are allowed to access anywhere. Why is it happening?

      S Offline
      S Offline
      sashidhar
      wrote on last edited by
      #2

      Maxdd 7 wrote:

      As far as my understanding means every one can access...!If u want to restrict access to every one and access to only login users it should be

      < deny users="?" / >

      if you want to give access to all remove tht section simple as tht..!

      LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

      M 1 Reply Last reply
      0
      • S sashidhar

        Maxdd 7 wrote:

        As far as my understanding means every one can access...!If u want to restrict access to every one and access to only login users it should be

        < deny users="?" / >

        if you want to give access to all remove tht section simple as tht..!

        LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

        M Offline
        M Offline
        Maxdd 7
        wrote on last edited by
        #3

        I need to give access to all to login.aspx, and restrict access to the rest, only to authorized users, that's why I allow unauthorized users to subdirectory images (so they can load images of login.aspx) and then try restrict access to the other pages :

        allow users="*" />
        <deny users="?" />

        But obviously I'm doing wrong..

        S 1 Reply Last reply
        0
        • M Maxdd 7

          I need to give access to all to login.aspx, and restrict access to the rest, only to authorized users, that's why I allow unauthorized users to subdirectory images (so they can load images of login.aspx) and then try restrict access to the other pages :

          allow users="*" />
          <deny users="?" />

          But obviously I'm doing wrong..

          S Offline
          S Offline
          sashidhar
          wrote on last edited by
          #4

          Maxdd 7 wrote:

          deny users="?"

          Why to give this again.Its no need..! Oh Your Folder Structure,i am not getting it ..!

          Maxdd 7 wrote:

          I need to give access to all to login.aspx, and restrict access to the rest, only to authorized users

          This is bit confusing:confused: You need to be more clear . AS far as my understanding..! 1)You have login page which need to access for all..! 2)The images in the login page is to be restricted to all user Is Tht what you Want to do? Then Thts bit typical way you are using..! try like this.Move the login.aspx to root..! but restrict only the folder images is a bad idea..!

          LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

          1 Reply Last reply
          0
          • M Maxdd 7

            I've the following on my web.config file:

            <authentication mode= "Forms">
            <forms name=".ASPXFORMSDEMO" loginUrl="login.aspx"
            protection="All" path="/" timeout="30" />
            </authentication>
            </system.web>

            <!-- Require authorization for all files -->
            <!-- in the "member" subdirectory        -->
            

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

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

            This last section (path="images") its because not authorized users need to access image files so they can load login.aspx. However, with this configuration, unauthorized users can access others .aspx, they are not redirect to login.aspx. They are allowed to access anywhere. Why is it happening?

            A Offline
            A Offline
            AlexeiXX3
            wrote on last edited by
            #5
             <allow users="\*" />      
             <deny users="?" />
            

            The first rule applies, in this case allow users = "*" If you want to only allow access to authenticated users, use something like deny users = "?" But never use allow users = "*" as the first rule, because oncea rule applies the ones below are ignored

            Alexei Rodriguez

            M 1 Reply Last reply
            0
            • A AlexeiXX3
               <allow users="\*" />      
               <deny users="?" />
              

              The first rule applies, in this case allow users = "*" If you want to only allow access to authenticated users, use something like deny users = "?" But never use allow users = "*" as the first rule, because oncea rule applies the ones below are ignored

              Alexei Rodriguez

              M Offline
              M Offline
              Maxdd 7
              wrote on last edited by
              #6

              AlexeiXX3 wrote:

              But never use allow users = "*" as the first rule, because oncea rule applies the ones below are ignored

              Yes that was the problem. So what I did is just put all files (except login.aspx) on a folder members, and then all I just need is that:

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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups