Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP.Net Users and folder access

Options
  • 20-08-2008 11:51pm
    #1
    Registered Users Posts: 5,238 ✭✭✭


    Hi, I'm hoping someone here with experience in the area might point me in the right direction.

    I have set up a site using a sql database setup by ASP to manage user membership and roles which works quite nicely.

    I would like users to be given a default directory into which they can create more directories and upload files(photos), what I'm wondering is which is the most conventional method to restrict access to these folders.

    I know I can create a location path for each in the web.config file using WebConfigurationManager and this is the method I'm most inclined to use but I was thinking that for a large website this would cause the config file to become huge so I wonder is there a prefered method.

    I could create a table in the DB for this and manually check it on the page displaying the files but that seems crude.

    I'm new to this so I hope you'll forgive me if I've overlooked something obvious!

    Any tips muchly appreciated.


Comments

  • Registered Users Posts: 2,931 ✭✭✭Ginger


    You are using Forms authentication is that correct?


  • Registered Users Posts: 1,266 ✭✭✭Overflow


    You could use the Profiles Provider and create a property to store a location for a Home Directory on each user. This way you dont have to create another table in your DB. ASP.NET already has built in support for user profiles.

    I would then create a Base Page class, that your Web Form will inherit. In this class create a function that checks the users Home Directory property in their profile. If the users Home Dir matches the current directory allow access, if the current direct does not match redirect to a Access Denied page or something.

    Then in the Page Load event in your web forms call your function from your inherited class. The purpose of the this inherited Base Page class is to give all your web forms common functionality, you dont have to do it this way of course, its just my suggestion:
    Partial Class _Default
         Inherits MyBasePageClass
    
         Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
               Me.CheckHomeDir()
    
         End Sub
    
    End Class
    


  • Registered Users Posts: 5,238 ✭✭✭humbert


    I'm not using windows authentication!

    Thanks Overflow, that's not a bad solution.


Advertisement