Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent writing to a folder in my website

Status
Not open for further replies.

tshad

Programmer
Jul 15, 2004
386
0
0
US
I am test HTTPWebRequest and want the page I am requesting to try to write to a folder and fail (usually its the other way around).

I then want to set up impersonation to write to it.

But I can't seem to stop the file.saveas to fail. It always writes the file.

Code looks like:

Code:
    HttpPostedFile file = Request.Files[f];
    file.SaveAs(Server.MapPath( "~/TestUploads/" + file.FileName));

I also have in my web.config:

Code:
   <location path="~/TestUploads">
      <system.web>
         <authorization>
            <deny users="*"/>
         </authorization>
      </system.web>
   </location>

How do I get it to stop the SaveAs in my code from writing the file and then how do I change it to only allow someone with the correct user password?

Thanks,

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top