user5026161
user5026161

Reputation:

Block the user from viewing files in the directory via the url

I'm pretty new in developing for VB.NET. I have a web application and I want to block the access to the files in a directory.

For example:

If the user access the following page: application.com/example/page.aspx

If the user remove the page name and type "application.com/example/", he will see all the files inside the folder "example".

I want to block this possibility and, when a user try to access the files, redirect to an error page.

I know how to solve this in PHP through htaccess, but I have never done it by VB.NET. Any help?

Upvotes: 0

Views: 81

Answers (2)

user8354234
user8354234

Reputation:

web.config or .htaccess will do.

Remember it is a security risk to have directories open for anyone to see.

Upvotes: 0

M Imran
M Imran

Reputation: 129

If you are using IIS then Go to your sites-->Desired Site

From Features Views Select Directory Browsing disabled.

Upvotes: 2

Related Questions