Friday, 12 July 2013

How to block different extension files accessed by unauthorized user before Login


    Web.config

    <system.web>
                   <!--Secure ASP.NET cookies-->
    <httpCookies httpOnlyCookies="true" requireSSL="true" lockItem="true" />
    <!—Extension files block for unauthorized user access-->
    <httpHandlers>
          <add verb="*" path="*.txt" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.pdf" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.jpg" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.gif" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.png" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.ico" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.xls" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.xlsx" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.csv" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.doc" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.docx" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.cab" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.htm" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.log" type="WebHandlers.Handler,WebHandlers"/>
          <add verb="*" path="*.xml" type="WebHandlers.Handler,WebHandlers"/>
    </httpHandlers>
    <system.web>

    Type of file extension added to block before login

    *.jpg, *.txt, *.xls, *.xlsx, *.png, *.gif, *.pdf, *.doc, *.docx

    *.csv, *.ico, *.cab,*.htm, *.log, *.xml



    i

No comments:

Post a Comment