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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

ASP.Net Users and folder access

  • 20-08-2008 10:51pm
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    You are using Forms authentication is that correct?


  • Registered Users, Registered Users 2 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, Registered Users 2 Posts: 5,238 ✭✭✭humbert


    I'm not using windows authentication!

    Thanks Overflow, that's not a bad solution.


Advertisement