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:
I also have in my web.config:
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
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