Click here to Skip to main content
15,889,266 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All



I want to secure folder of my website

for example if some one do http://localhost/dmat_new/templocation/mayur.doc then it is giving access to mayur.doc which is in templocation folder of my website
Posted
Updated 21-May-12 20:57pm
v2
Comments
OriginalGriff 22-May-12 3:01am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Why can't the user access it? Why shouldn't they access it?
Use the "Improve question" widget to edit your question and provide better information.

1 solution

Using the location element in web.config should take care of this:

XML
<location path="templocation">
  <system.web>
     <authorization>
        <deny users="*"/>
     </authorization>
  </system.web>
</location>


More info:

http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx[^]

http://msdn.microsoft.com/en-us/library/ms178692.aspx[^]
 
Share this answer
 
v3
Comments
Nilesh Patil Kolhapur 22-May-12 3:07am    
good Answer jim lahey
mayur csharp G 22-May-12 3:21am    
thanks

it is giving error

<location> path attribute must be a relative virtual path. It cannot contain any of '?' ':' '\' '*' '"' '<' '>' or '|'.
mayur csharp G 22-May-12 5:23am    
can you please suggest more
jim lahey 22-May-12 6:28am    
Did you do what the error message told you? Change the path attribute to a relative virtual path. I've amended my answer for you.
mayur csharp G 22-May-12 6:43am    
Dear I am not getting

what should i do for protecting all files and folders in TEMPLOCATION folder of my web site

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