在下面的代码中,我希望下载按钮实际下载文件,但是我收到以下错误:
HTTP错误404.0 - 未找到 您要查找的资源已被删除,名称已更改或暂时不可用。
我检查了路径,文件在那里。可能导致这种情况的原因是什么?
<asp:UpdatePanel ID="updatePanel" runat="server">
<ContentTemplate>
<div>
<div class="balClear">
<asp:Label ID="downloadLabel" CssClass="balDownloadLabel" runat="server"/>
<asp:ImageButton ID="downloadButton" CssClass="balDownloadButton" ImageUrl="delete.png" OnClick="downloadButton_Click" runat="server" Width="25" Height="25" />
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="downloadButton" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
cs code:
string groupURL = "~/Uploads/Group/";
string privateURL = "~/Uploads/Private/";
string folderURL
{
get { return IsGroup == true ? groupURL : privateURL; }
}
public bool IsGroup
{
get { return ViewState["balUploader_IsGroup"] == null ? false : (bool)ViewState["balUploader_IsGroup"]; }
set { ViewState["balUploader_IsGroup"] = value; }
}
protected void downloadButton_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect(folderURL + "abcd.txt");
}