Click here to Skip to main content
15,885,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
<b>Hii Plz help me...</b>
In my project the one folder that contains only image and doc file... Bt problem is that any can access or download that files through give full path in URL...

So How Can i prevent to this.. Plz Reply
Thanks Advance<big></big>
Posted

1 solution

if you are using .Net use global.asax and use below code in your global.asax code behind file

Sub Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
    ' Fires right before the request handler executes
    'Files is folder in the  file path
    If Context.Request.Url.AbsoluteUri.IndexOf("/Files/") > 0 Then
        If Context.Request.Url.AbsoluteUri.IndexOf(".doc") > 0 Then
            Context.Response.End()
        End If
    End If
End Sub
 
Share this answer
 

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