<asp:GridView runat="server" id="GrdVw_Download">
<RowStyle cssclass="ItemStyle" />
<HeaderStyle cssclass="tableheader" horizontalalign="Left" />
<AlternatingRowStyle cssclass="AlternateItemStyle" horizontalalign="Left" />
<FooterStyle backcolor="#5D7B9D" font-bold="True" forecolor="White" />
<Columns>
<asp:BoundField headertext="File name" headerstyle-horizontalalign="Center" itemstyle-horizontalalign="Center"
datafield="FileName" />
<asp:BoundField headertext="File Size" headerstyle-horizontalalign="Center" itemstyle-horizontalalign="Center"
dataformatstring="{0:#,### bytes}" datafield="Length" />
<asp:BoundField headertext="Extension" headerstyle-horizontalalign="Center" itemstyle-horizontalalign="Center"
datafield="Extension" />
<asp:TemplateField headertext="Download Brochure" itemstyle-horizontalalign="Center"
headerstyle-horizontalalign="Center">
<ItemTemplate>
<a href="?dl=<%# Encryptor.encrypt(((FileInfo)Container.DataItem).FullName) %>"
title="Download <%# ((FileInfo)Container.DataItem).FileName %>">
<%# ((FileInfo)Container.DataItem).FileName %>
</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
这是我的 gridview 标记,下面是数据绑定部分
DirectoryInfo ProviderFolder = new DirectoryInfo(strFolderPath);
FileInfo[] BrochureList = ProviderFolder.GetFiles();
if (BrochureList.Length > 0)
{
GrdVw_Download.DataSource = BrochureList;
GrdVw_Download.DataBind();
}
在这一行的 gridview 中,<a href="?dl=<%# Encyptor.encrypt(((FileInfo)Container.DataItem).FullName)
我得到了帖子谈到的错误。Encryptor 在哪里加密 FilePath 并且标记生成一个链接来下载文件
编辑抱歉:
*解决了它。* 这不是文件名,而只是名称。再次抱歉