.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to restrict folder access to users and theirs only

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

Hi. I created a web application using "Forms Authentication". 

There is a folder name "uploads", and it creates subfolders as username when they register. Web application stores users' files and images under their folder ("uploads/username")

I tried to find a way to restrict users to download and upload files to their folder only and couldn't find a good one. 

Then I came up with this idea that stores "web.config" file each time user registers and the web.config should look like below. Username will be changed dynamically according to username.

This method actually works but I am little worried if this is a good practice as far as performance wise. Because it'll create web.config files as many as users and there might be other holes that I don't recognize. 

I appreciate any advice or better suggestion for this problem.

--------web.config in "/Root/uploads/username directory"--------------

<location path="HRpages">

View Complete Post

More Related Resource Links

Access denied to folder in ASP.NET project either though I have granted all users full permissions !



i have made a very simple file upload app, that i want users to be able to upload images to a folder on my server, well localhost for the time being Stick out tongue

here is the simple upload code...

        protected void ButtonRegisterDetails_Click(object sender, EventArgs e) 
            // display properties of the uploaded file 

Restrict folder access in Report Server

Hi There, I am creating folders each of our end users in Report Server, who upload their reports to their respective folder. I want to allow users to see and access only their folders and they should not be able to see others folders available on the Report Server, it is possible? If Yes, how do I do it? Thanks for your help. Regards, Suresh

restrict access for a single group to a single folder in a list


Hello and Goodmorning,

I have one list, organized with 3 folders.

I can create a group(s), add user(s) to this group(s). 

Now i need to assign access like this:  group1 can only see and 'readonly' folder1, group2 can only see and 'readonly' folder2, group3 can only see and 'readonly'...folder3!

Im sure this is possible, from similar non-programming posts on the forum.

I have been looking into SPRoleAssignment and SPRoleDefinition to define Group permissions but its the mapping them to specific folders that I am missing...

Enjoy your tea.







TreeView in Web Part required webctrl_client folder to have atlease read access for all users


HI All

I am using the TreeView control from the Microsoft.Web.UI.WebControls Namespace to render a treeview in a SharePoint web part. The tree nodes images do not appear (text is rendered) properly until i grant atleast read permissions to Authenticated Users on the webctrl_client folder which has to be places in the web application's virtual directory.

Is there some way I can avoid granting the read permission on that folder to all authenticated users.

If i go ahead with the approach of giving the authenticated users rad permission, will a user loggedin via FBA get the read permission

Thanks in Advance

How to restrict access to a SharePoint Document Form Library while allowing users to fill out and su


We have created a MS InfoPath form with it's corrsponding SharePoint Document Form Library, but would like to restrict the access to the SharePoint Document Form Library. After the user completes and submits the forms then he/she should not be able to go into the SharePoint Document Form Library and view the form. In order to allow users to fill out and submit an InfoPath form, Contributor level access is required to be granted. But Contributor level access allows them to view not only the form he/she has created but everyone else's which is not acceptable in this particluar situation. The solution we've come up with is to grant Contributor access to the SharePoint Document Form Library when the Submit button is pressed using stsadm grant the user Contibutor role. Then remove the access once the submission is completed.

We would be interested to know if there is a better process to accomplish this task. And, of equal importance, the coding that is required to execute this task.

Access Classes in an aspx page that is in folder in asp.net


I have classes in App_Code:
Connection.cs, ClientData.cs ....

I have a folder Authenticated within it have an aspx page Client.aspx

How do I access the page through Client.aspx ClientData.cs the class, because there is a mistake for me to define the class as I do, please help me!

Hide documents from being access by unauthorized users.


Hi experts,

I would like to know how to hide certain documents (eg. Word, Excel, PPT, PDF) in a document libraries from unauthorized users? I tried implement Target Audience, but it doesn't work. If anyone know, i really appreciate for the guidance.

p/s: If my posting is not relevnt to the thread, please kindly move it to the appropriate places. Thanks!

ASP.NET Allow Admin Users Access Basic Users Accounts


We have an ASP.Net web application currently released to the public, that uses Membership and Provider features and have our users assign to a "Basic" role.  What we are working on doing is developing an administrative site, so that administrators (presumably to be assigned an "Admin" role), are able to login to the administrative site, where they will have access to a list of users in the "Basic" role.
From the admin site, we want to allow the administrators to click on any of the "Basic" users and effectively be logged into there account (loading the user's profile information in the process, as is the case when a "Basic" user logs in), while still remaining lo

Who to restrict access to only one view.

What is the best way to grant access for a user, to select from only one view, not the actual tables?

"Only their own" allows users to edit, then shows access denied page

I am managing a WSS 3.0 portal.  I have created custom lists where a group has contribute permissions.  Under List Settings|Advanced Settings, when I set Edit Access to "Only their own" or "None", my test users can see the Edit Icon and the Edit Item menu option, and bring up the Edit Form.  When they click "OK", they get the Access Denied page.  My experience in that past is that they should not even been shown the option to edit, and they should get Access Denied if they somehow navigate to the EditForm.aspx page.  I even tested this on a brand new site, with three Links lists, each with different Edit Access Levels (All, None, Only their own).  I added one user with contribute permissions.  He had the same result: He could get all the way to EditForm.aspx, but got "Access Denied" when he submitted his changes.  What can I do to fix this?Christopher W. Douglas

All Users (Including Site Collection Admins) receiving Access Denied from one Site Collection

I usually spend my time in the forums answering questions.  But this time I need the help. I’ve got a client who somehow has succeeded in locking EVERYONE out of one of their Site Collections.  Users can authenticate to the site, but get an accessdenied page when you try to access anything in the site collection, including pages served from the _Layouts virtual directory.  The AccessDenied page shows that they are authenticated, but not authorized.  This is true for Site Collection admins and user’s who have been given Grant Full Control via a Web Application Permission Policy.  Central Admin and one other site collection are behaving normally.  I've already checked for database permissions - the service account can access the database fine. I've also checked for a locked database or overextended quota.  It's not that either. The accessdenied page url references the users list in the root of the site collection as the offending list denying access.   Does anyone have any ideas?Paul Stork SharePoint Server MVP

Authentication for External Users to Access MOSS 2007 Resources

Our MOSS 2007 supports users from two domains that authenticate using windows.  Our clients WindowsXP in domain#1 and WindowsVista in domain#2 (which has presented problems authenticating to MOSS 2007.  I would like to give access to external users outside of those two domains.  However, our management does not want to establish trusts between domains.  What would be the best practice to accomplish this?  Additionally, will MOSS 2010 or Forefront resolve these issues?

How to access Bin Folder of Subdirectory?

Hi,        I have one my WebApplication called "WEB1" in which I have App_Code folder and Bin Folder and I have one more webApplication called "WEB2" in which also Bin and App_Code Folder is exist.Now my requirement is to Merge WEB2 Project into WEB1 with creating one subDirectory called "SUBWEB2" , While rebuilding my solution I am getting error:The type or namespace name 'MyDummyBinDLL' could not be found (are you missing a using directive or an assembly reference?MyDummyBinDLL is presented under "SUBWEB2" sub directory now I have two Bin Folder one is WEB1 Root directory and second Bin is under SUBWEB2, I can not move my SUBWEB2 Bin folder DLL into root Bin folder,So now my problem is how can I access my SubDirectory Bin Folder do I need to rename my Bin Folder, if I will renamed it do I need any configuration in Web.Config.Please if any one have any code or solution please share with me.Thanks & RegardsVikrant....

How to know all the users on Sharepoint 2010 and what access do they have ?

Hello,   I'm using SharePoint 2010 , and i was wondering if there is a way to "extract" the user's list that are using Sharepoint and what do they have access to in the sharePoint? if there is a way using the central Administration or if there is a PowerShell command line to use... thnx alot.

Allowing internal users access to Sharepoint site externally

Good afternoon.   This may be a simple answer (I hope so actually) but I haven't been able to figure this out. What I need: I have internal users who can access my Sharepoint site easily while logged onto my network, and external users who I have added to our Active Directory system who can access the site using our external URL.  Both work fine. What I am having problems with:  One of my users (internal) is on a different AD (he is on our European network) and he can not access the site either from the VPN (when he is in the US) nor from the external site (it will take him to the logon screen, but since he doesn't have an account on our AD, it won't let him in). I understood from our European IS department that all we had to do was give him both internal and external access to the Sharepoint site, and he would be able to connect from anywhere. So, how do I do that (give him both)?  Do I need to have our IS team turn on MOSS2007 to do this (it is not turned on today). Many thanks, I am still a newb at Sharepoint, but trying to learn quickly. Thanks, Jim  

how to access items inside Sharepoint List Folder

hi all i have a list with structure as below  QuckList(List)                A(Folder)                       1(List Items)                       2(List Items)                B(Folder)                        1(List Items)   i have to display the List items inside the folder in drop down   i am able to access the folder as Splistitem, but not able to access the items inside the folder   any ideas how to access the items inside the List Folder   ragava_28

SharePoint sites users have access to

Hi All, Is there any way that I can check what SharePoint sites users have access to? Thanks!  
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend