File upload permissions prohibited by Godaddy Shared hosting

I have a godaddy sharing web application. This is an asp.net application. Everything works fine, but when I upload a file, it gives the error "Access to path" PATH "is denied."

I tried several ways how to provide full permission to the folder into which I upload the file from the godaddy control panel.

I also saw this post and tried to follow it: http://forums.asp.net/t/1052417.aspx/1

But no help.

Can someone tell me what is wrong there. Its under IIS 7.

+3
source share
3 answers

Follow this: Source - 2

" Windows"

< 2 >

- , .

Ref: - Windows

IIS " " . , FTP. -, , , .

+6
  • " "
  • "" (. ).
  • " "
  • (, , "Plesk IIS Worker Identity Account", )

enter image description here

+11
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindGrid();
        }
    }
    protected void BindGrid()
    {
        string[] filePaths = Directory.GetFiles(Server.MapPath("~/images/"));
        List<ListItem> files = new List<ListItem>();
        foreach (string filePath in filePaths)
        {
            files.Add(new ListItem(Path.GetFileName(filePath), filePath));
        }
        GridView1.DataSource = files;
        GridView1.DataBind();
    }
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(Server.MapPath("~/images/") + FileUpload1.FileName);
            BindGrid();
        }
        else //enter code here
        {
            Response.Write("Please select file to upload");
        }
    }
    protected void DownloadFile(object sender, EventArgs e)
    {
        string filePath = (sender as LinkButton).CommandArgument;
        Response.ContentType = ContentType;
        Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath));
        Response.WriteFile(filePath);
        Response.End();
    }
    protected void DeleteFile(object sender, EventArgs e)
    {
        string filePath = (sender as LinkButton).CommandArgument;
        File.Delete(filePath);
        BindGrid();
    }
}
0
source

All Articles