Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

* * * * * 1 votes

How to provide access only to authenticated user to particular folder in asp.net

asp.net asp.net core iis

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1 AlexiaPamelov


    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 16 June 2016 - 11:30 PM

I have ASP.NET web application hosted on asphostportal

I have to provide access to only authenticated users to a particular list of pdf kept in a folder "PdfFiles" in root directory.

I was trying below configuration settings in web.config, but it did not work, with this setting still this folder is accessible to all the users. I have form authenticated enabled for this site.

<location path="PdfFiles">
      <deny users="?" />
    <allow users="*"/>

Also I noticed that anonymous authentication was enabled for "PdfFiles" folder in IIS. If I disable this, it does not allow authenticated or anonymous, any of the user to access the pdfs.

So configuration change or IIS change, none of them worked. Can any one help me out on this issue?



#2 charlie313


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 18 July 2016 - 11:37 AM

I have the same problem and I need help !!!

#3 lespauled


    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1360 posts

Posted 19 July 2016 - 05:48 AM

<location path="AdminFolder">

      <allow roles="Admin"/> //Allows users in Admin role

      <deny users="*"/> // deny everyone else


Assign the users to a role, then allow that role to have access to that location

My Blog: http://forum.codecal...699-blog-77241/
"Women and Music: I'm always amazed by other people's choices." - David Lee Roth

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download