Home All Groups Group Topic Archive Search About

File Upload ASPX - Access Denied Problem

Author
12 Jan 2005 2:59 PM
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>

Author
12 Jan 2005 8:01 PM
GooglePoster
Permissions on the server? Probably the ASPNET (IIS 5) or the NETWORK
(II6) account doesn't have the correct permissions?

CuMPeEWeEr [No MCSD] wrote:
Show quote
> 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">
Show quote
> <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);
Show quote
>
>    string my_file_path = Server.MapPath(this.TemplateSourceDirectory
+ "/" +
> my_path) +  "myfile.txt";
>    postedfile.SaveAs(my_file_path);
>
>   }
>   catch (Exception ex)
>   {
>
>   }
>
>  }
>
> </script>
> <html></html>

AddThis Social Bookmark Button