Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi I am facing problem to give security to my Private folder files. I have a login page and a Private folder in my solution.

Inside Private folder I have an default page where i am redirecting the user those are authenticated and in that page one button is there where user can download his file by clicking on that button.

I am able to redirecting the secure page if the user is an authenticated user but what will happen if user directly type the folder path along with the file name, in this scenario I am unable to protect my secure file. Please Suggest me how would I overcome from this situation

Thanks
Prafulla
Posted
Comments
Dholakiya Ankit 15-Jul-13 1:27am    
you need another web.config file into ur folder and there do authentication

1 solution

Well the feature you are expecting can be full filled with the help of Forms Authentication.Refer this link.

How to: Implement Simple Forms Authentication[^]

Once you made necessary changes suggested there,any unauthenticated user(Typing URL directly can be considered as unauthenticated) will be redirected to Login URL specified. Once she provides appropriate credentials,she will be granted access accordingly to that page.

Regards.. :laugh:
 
Share this answer
 
Comments
Prafulla Sahu 15-Jul-13 2:04am    
hi ankit thanks for your reply.
Yes ankit, my folder has another web.config file

<location path="~/Private">
<system.web>
<authorization>
<allow users="tester">
<deny users="?">



but still I am unable to provide security for direct access of my secure file through URl
Thanks7872 15-Jul-13 2:07am    
Ankit? Not Ankit,Rohan here. Well,make necessary changes that are suggested there in each and every web config files you have. That code is tested and working.
Prafulla Sahu 15-Jul-13 2:10am    
I am able to provide security to those secure pages which are inside my Private folder although some body is accessing from URL but the same thing is working for files present inside that folder
Thanks7872 15-Jul-13 2:16am    
You have not made changes suggested in that link. You have just opened and closed that link. See,if you dont want to follow the suggestions than dont waste your as well as our time.I already told you Once you made necessary changes suggested there,any unauthenticated user(Typing URL directly can be considered as unauthenticated) will be redirected to Login URL specified.
Prafulla Sahu 15-Jul-13 2:36am    
hey Rohan I am not here to kill your and my time as well I think you haven't read my post clearly just read it once again there I have clearly mentioned that I am able to give security access to all the pages inside my private folder although you are accessing those pages from URL without authenticated but the same thing is not working when I am browsing a file from the same location. Thanks for your reply

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