0

I have tried to show the static content of a website like pdf files or images only to authenticated users using ASP.net Forms authentication and authorization rules. I put in my root config file the following configuration :

<system.web>
      <authentication mode="Forms">
         <forms name=".ASPXAUTH" loginUrl="Login.aspx">
      </authentication>
</system.web> 

And in the folder that I have the pdf files and images a config file with the following configuration:

<configuration> 
   <system.web> 
      <authorization> 
         <deny users="?" /> 
      </authorization> 
   </system.web> 
</configuration>

It works when I am not login in the website I cannot see the files and I get redirected to the login page, but the issue is that I cannot see the files even when I log in to the website, it still redirects me like I am not logged in when I try to see the files. Can you please help me what I am doing wrong?

RL20
  • 3
  • 3
  • https://stackoverflow.com/questions/2903292/how-do-i-protect-static-files-with-asp-net-form-authentication-on-iis-7-5 – Ankush Jain Jan 05 '18 at 12:15
  • This works only running the website in Integrated mode? Because I have an issue running my website in Integrated mode. I have an website that uses .Net 2.0 and I have edited the config file to use instead of and instead of that are for classic app pool, but the website never loads, it takes to much time and then it just throws the error ERR_Connection_Timed_Out, when I turn back to classic app pool there is no issue. I don't know where the issue could be and what should I do? – RL20 Feb 18 '18 at 22:58

0 Answers0