Thursday, 10 October 2013

How to restrict download of specified file types in ASP.NET using web.config



In this post i am writing how to restrict your web application so that .txt or any other type files (whatever file extensions you want ) files can not be downloaded. 

Open your web.config file and register following setting in your web.config


<system.web>
   <httpHandlers>
       <add verb="*" path="*.txt" type="System.Web.HttpForbiddenHandler" />
   </httpHandlers>
</system.web>



0 comments:

Post a Comment