Click here to Skip to main content
11,483,002 members (73,584 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET security
Is there any way by which we can secure our data from the clients.


Can we put authentication over parent directory.

examples:Generally to access the images used in website can be accessed like this:

How to put limit on that.
Posted 21-Sep-12 8:28am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You can disable directory browsing. Refer:
How to enable directory browsing with IIS7 web.config [^]

Further, using authentication and authorization, you can put security permissions on any folder of your application:
ASP.NET authentication and authorization[^]
MS Support: HOW TO: Control Authorization Permissions in an ASP.NET Application[^]
footballpardeep at 21-Sep-12 14:05pm
Sandeep Mewara at 21-Sep-12 14:10pm
footballpardeep at 21-Sep-12 14:21pm

I added this code to subdirectory of images.But still i am able to access it.
Sandeep Mewara at 21-Sep-12 14:23pm
Did you go through the links I shared?
footballpardeep at 21-Sep-12 14:26pm , i used this link, to restrict access to subdirectory
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

URL Authorization in ASP.NET – Securing your websites[^] explains how to set security permissions on individual web pages, web services and sub directories.

Please have a look.
footballpardeep at 21-Sep-12 14:05pm
Tadit Dash at 21-Sep-12 14:18pm
Anytym... My pleasure...

Thanks a lot...
footballpardeep at 21-Sep-12 14:20pm
I added it to subdirectory. But i still able to access.


Tadit Dash at 21-Sep-12 14:26pm
There is nothing in between the pre tags...
You have missed something I guess...
footballpardeep at 21-Sep-12 14:28pm
i pasted the code, but is not visible, i used ur link, of restricting access to subdirectory
Tadit Dash at 21-Sep-12 14:30pm
Use "code" tags instead of "pre" tags...
footballpardeep at 21-Sep-12 14:32pm

Tadit Dash at 21-Sep-12 14:33pm
Don't use any tags, only post the code now.
footballpardeep at 21-Sep-12 14:37pm
it's again not visible
footballpardeep at 21-Sep-12 14:40pm
I have just aded a new web.config file to subdirectory.

xml version="1.0"?
deny users="?"
i removed < >from the code
footballpardeep at 21-Sep-12 14:54pm
solved thanks
Tadit Dash at 21-Sep-12 14:57pm
Oh so finally. Congrats...
If it had helped you, then mark it as answer to help others searching the solution easily... You will also be awarded for this action... :) :)

Thanks a lot...
Tadit Dash at 21-Sep-12 15:19pm
Thanks for accepting...

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

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100