how to disable directory listing like htpaccess in ?

i like to implement the same as below in application
is it possible by this way ?
author said like this ..
"By default when accessing any directory which does not contain an index file (ex: 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 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?
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 site.
Daniel JungesCommented:

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

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.