Click here to Skip to main content
16,021,417 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Dear all,

I have my website on ftp server. There is a folder which has important file within it. I want to make this folder password protected. I got some steps to make this but its at hosted control panel. Now I want to access that same folder at run-time so that I can copy the selective data from it and paste it into another directory.

I am sure through this I can achieve security but not sure whether this is possible and how?

Thanks,
Posted
Comments
Andrew Piotrowski 28-Dec-11 19:17pm    
What attributes has the Folder ? Is it possible to use the standard membership provider and choose You as the User that have all access and other with other privileges ? Need more info. Then i can write step by step.
comred 28-Dec-11 23:29pm    
The folder is at ftp server. which has some files e.g. .docx or .pdf etc. I want to copy some of those files into a new folder which is created at run time. Now as you mentioned I can go for membership provider to assign privileges. But I dont know how to do it for a directory, and my concern is if I did it so, then will i able to access that folder at runtime?
If still you are not clear about what I want then please let me know.
And thanx for your comment....

1 solution

OK , i get the point :)

In web.config

XML
<?xml version="1.0" encoding="UTF-8"?>
 <configuration>
   <system.web>
     <customErrors mode="Off">
     </customErrors>
== Here is the solution ==
HTML
<authentication mode="Forms">
== It's the common way but you can also use HTML (JS) ==
HTML
<forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="999999">
        <credentials passwordFormat="MD5">
== Login and Password ==
HTML
<user name="admin" password="21232F297A57A5A743894A0E4A801FC3" />
       </credentials>
     </forms>
   </authentication>
   <authorization>
== Here you set the what kind of group or each user ==
HTML
<allow users="?" />
      <allow users="*" />
    </authorization>
    <trace enabled="true" localOnly="false" />
  </system.web>
== Location ( the folder is called administration )
HTML
<location path="administration">
    <system.web>
      <authorization>
== Here you set the what kind of group or each user ==
HTML
<allow users="admin" />
        <deny users="*" />
      </authorization>
    </system.web>
  </location>
</configuration>
 
Share this answer
 
v2
Comments
Orcun Iyigun 29-Dec-11 11:50am    
Edited for readabilty. Added XML tags.
comred 29-Dec-11 22:58pm    
Thanks Andrew.... :)

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