[英]Show video file in listview keep download option in asp.net
My concept is about stegnography. 我的概念是关于描写术。 I want to play the video file and keep the download option.
我想播放视频文件并保留下载选项。 If the client clicks the download button, the video along with registration message should download.
如果客户端单击下载按钮,则视频和注册消息均应下载。
I used the following code 我用下面的代码
in .cs 在.cs中
DirectoryInfo dir = new DirectoryInfo(MapPath("~/Video"));
FileInfo[] files = dir.GetFiles();
ArrayList listItems = new ArrayList();
foreach (FileInfo info in files)
{
listItems.Add(info);
}
DataList1.DataSource = listItems;
DataList1.DataBind();
in design 在设计中
Font-Names="Verdana" Font-Size="Small" RepeatColumns="3" RepeatDirection="Horizontal"
Width="600px" ForeColor="#333333">
<ItemTemplate>
<br />
<b>Song Name:</b>
<asp:Label ID="lblCName" runat="server" Text='<%# Bind("name") %>'></asp:Label>
<br />
<video controls="controls" width="200" height="200" src='<%# Eval ("name","Video/{0}") %>'></video>
<br />
<b>Download:</b>
<asp:LinkButton ID="LinkButton1" runat="server" Text='<%#Eval("name") %>'></asp:LinkButton>
here download option is not working, can any 1 give some idea for this plz. 这里的下载选项不起作用,任何1都可以给这个plz提供一些想法。
The best[*] way to download a big file, like a video, is to use a handler. 下载大文件(例如视频)的最佳[*]方法是使用处理程序。
So you create a handler that send the file and you send the parametres of what file to download on the url. 因此,您将创建一个处理程序来发送文件,然后发送要下载的文件的参数,并将其下载到url上。 For example you can do something like:
例如,您可以执行以下操作:
<b>Download:</b> <a target="_blank" href="download.ashx?name=<%#Eval("name") %>'>"><%#Eval("name") %>'></a>
And on the handler download.ashx
you read the parameter "name" and you send that file. 然后在处理程序
download.ashx
读取参数“名称”,然后发送该文件。
This also can help you: 这也可以帮助您:
What is the best way to download file from server 从服务器下载文件的最佳方法是什么
asp.net ashx handler prompting download instead of displaying file asp.net ashx处理程序提示下载而不是显示文件
files download using HTTP Handler 使用HTTP处理程序下载文件
[*]Why is the best way to use a hander ?: [*]为什么使用处理程序的最佳方法是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.