File Upload ASPX - Access Denied Problem

  • Thread starter Thread starter CuMPeEWeEr [No MCSD]
  • Start date Start date
C

CuMPeEWeEr [No MCSD]

I have a very simple file upload script (see below), it works for me
locally. But when I ftp it to my production server, whenever I click on the
"Upload" button, it prompts me for the Windows userID/password. If I hit
"cancel", IIS gives me the following error message:

Access is denied.
Description: An error occurred while accessing the resources required to
serve this request. You might not have permission to view the requested
resources.

Error message 401.3: You do not have permission to view this directory or
page using the credentials you supplied (access denied due to ACLs). Ask the
Web server's administrator to give you access.


Anyone knows where exactly the permission isn't setup properly? Why is it
only happen to upload? I have no problem in seeing HTML, JPG, etc.. Please
help.

C.P.


----------------------------
Upload.html
----------------------------
<html><body>
<form method="post" enctype="multipart/form-data" action="Upload.aspx">
<input type="file" name="userfile">
<input type="submit" value="Upload">
</form>
</body></html>

----------------------------
Upload.aspx
----------------------------

<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>

<script language="C#" runat="server">

void Page_Load()
{
string my_path, strFileName;
my_path = "upload/";

try
{
HttpPostedFile postedfile = Request.Files[0];
strFileName = postedfile.FileName;
strFileName = strFileName.Substring(strFileName.LastIndexOf("\\")+1);

string my_file_path = Server.MapPath(this.TemplateSourceDirectory + "/" +
my_path) + "myfile.txt";
postedfile.SaveAs(my_file_path);

}
catch (Exception ex)
{

}

}

</script>
<html></html>
 
Permissions on the server? Probably the ASPNET (IIS 5) or the NETWORK
(II6) account doesn't have the correct permissions?
 
Back
Top