how to disable directory listing like htpaccess in asp.net ?

i like to implement the same as below in asp.net application
is it possible by this way ?
http://blog.eukhost.com/webhosting/enabledisable-directory-listings-using-htaccess/
author said like this ..
"By default when accessing any directory which does not contain an index file (ex: http://yourdomain.com/images/) a directory listing will be shown displaying a list of the files in that folder. Simply adding a blank/ 0 byte text file named “index.html” will prevent this directory list from being displayed" But it doesnot work

if i have index.htm  in a folder of application and then  opened the directory listing on the browser it stills displays the listing and not showing the index.htm page ?

what is alternate solution for .htaccess in asp.net application?

or is this the only way
Using IIS manager right click on the folder that you want to disable browsing , and then uncheck "Directory Browsing" option

Any other way we can implement it by either using .htaccess approach or using vb/C# coding?
LVL 18
Rajar AhmedConsultantAsked:
Who is Participating?
 
CodeCruiserCommented:
Did you see this in the link above?

By default, directory browsing is disabled in IIS so that users cannot see the contents of directories.

If index.htm does not work, use a default.aspx as its an asp.net site.
0
 
Daniel JungesCommented:


appcmd set config /section:directoryBrowse /enabled:true|false

see: http://technet.microsoft.com/en-us/library/cc731109(WS.10).aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.