Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to protect the static files in asp.net. If the user logged in should allow to access the files(i.e having folder like samples under this folder multiple files are available) other wise redirect to login page.
Posted

1 solution

 
Share this answer
 
Comments
Arul Prasad E 11-Feb-15 1:11am    
How to permission for Dynamic users, Stored in database.
You need to use * and ? with your conditions. Else you can restrict using the Roles.

One other simple way is to check if Session Exists or not on Page Load Event. If Session is there, then no need to restrict. If Session is absent, then user is not logged in. So, then you can restrict access and redirect to the Login Page.
Arul Prasad E 11-Feb-15 1:23am    
Within the folder files are uploaded dynamically, If the file may be .html or .aspx
Arul Prasad E 11-Feb-15 1:45am    
While using authentication the below error occurs,

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
Search this error in Google. You will find many answers. Try them. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900