In SP 2007, I have custom control to create/edit/delete tasks. When a task is created, a separate folder is created in Documents Library by the name of task id.

Now, create/edit/delete access for tasks are checked in the custom controls itself. So if a user have edit access on the task then only he/she can attach the documents.

Now problem is user can easily go the URL http://site/Documents/task_id to access the attachment folder and can upload docs even if no edit access. Since its not a custom control, we cannot have customized access check there.

How to have a customized access check when user access document lib via URL?

1 Answer 1


Since you want to check if the user is accessing the document library via URL, then you could add a web part on the page folder page. For example, if you create a separate folder inside the document library each time a task is created, then the I assume the URL would be:


Then on the AllItems.aspx of that document library, you could add a custom web part, which check if the request has referrer (clicked through link, button, etc.)

protected void Page_Load(object sender, EventArgs e)
   if (Request.UrlReferrer == null)
       return Response.Redirect("http://yoursite.com/NotFound.aspx");

   // Code if the user access this page through link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.