Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have location on the IIS. To that location Directory browsing is Turned Off. But I have .exe file in the folder. User is able to download the exe file when he gives the full path in the browser. Any Suggestions how i can re direct to dummy page when tries to access the .exe file.

-TIA

What I have tried:

I have location on the IIS. To that location Directory browsing is Turned Off. But I have .exe file in the folder. User is able to download the exe file when he gives the full path in the browser. Any Suggestions how i can re direct to dummy page when tries to access the .exe file.
Posted
Updated 14-Mar-16 2:15am

1 solution

If you want to prevent all *.exe files being downloaded, then you can remove the mime type definition from the site. Without a mime handler the end user cannot get a file with that extension
 
Share this answer
 
Comments
MYQueries1 14-Mar-16 8:21am    
I want to block for un-authorized . not for all users
MYQueries1 14-Mar-16 10:36am    
Thing is my exe file is kept in another server. Which is not same where my webapplication hosted
Andy Lanng 14-Mar-16 11:49am    
Oh in that case:
Change the permissions of that folder so that no one can access it bar the IIS account (IIS_USRS i think), then create a handler in the webapp (ashx) to download the file if requested correctly. ashx files are very much like aspx files in that they have a copy of the Request instance. Within that instance you can look at the user and user roles.
If you cannot restrict access to the folder then the issue is with the setup of your servers. You must restrict the folder so it cannot be seen by the public, even if browsing is turned off (browsing off only means that they can't see the folder structure, they can still access files in the structure.

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