Download A Video File With C#
Jul 30, 2010i want code to downlaod a video file using asp.net with c#
View 3 Repliesi want code to downlaod a video file using asp.net with c#
View 3 RepliesI've configured progressive video player on my website. When I'm passing direct url to .mp4 file everything works fine.
when I'm trying to pass file bytes from my .ashx file. Player begins to play but if you try to seek it'll write buffering, buffer video till the seekpoint and continue to play.
here is my file download script in .ashx handler
FileStream sourceFile = new FileStream(FileName, FileMode.Open); long FileSize; FileSize = sourceFile.Length; byte[] buffer = new byte[(int)FileSize]; sourceFile.Read(buffer, 0, (int)sourceFile.Length); sourceFile.Close(); context.Response.AddHeader("Content-Disposition", "attachment;filename=file.mp4"); context.Response.ContentType = "application/octet-stream"; context.Response.BinaryWrite(buffer);
how to download a video file .wmv and save it to the user's disk when click a button without using the browser save link as
View 2 Repliesi m trying to download song and video using following code but it only save can't download it
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "id")
{
string url = Convert.ToString(e.CommandArgument);
//Response.Redirect(url);
FileInfo fileInfo = new FileInfo(url);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name);
//Response.ContentType = "application/octet-stream";
Response.ContentType = "application";
Response.Flush();
}
}
i am using amazon s3 service. now i want to show download dialog box in my asp.net application when user come on download page. i am using amazon sdk.
View 1 RepliesI'm about to submit my pad file to multiple sharware sites but the pad file has to have a direct link to the download file and can't link to a download page which is what I would like to do, so I can track the traffic and get the downloader's email before allowing the download. I am running an ASP.NET site in VB. Is there a way to tell the web app to redirect to a specific aspx page when it receives a request for a specific file?
View 1 RepliesI have added linkbutton inside gridview to download, below is my code..
protected void lnkDownload_Click(object sender, EventArgs e)
{
try
{
[Code].....
its giving me following error
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack"
I need to download a .mp3 file from a folder. during download a new blank page should open and after downloading it should close automatically.
View 1 Repliesi m creating asp.net Mobile website page to download symbian .sis file to mobile ,but its not geting download properly.its working perfectly on desktop.
View 2 RepliesI am downloading file from database using the following code. This code downloads an excel file from the database which has a macro attached to it when it is opened. This macro reads file name of the excel file and uses it for its computation. Everthing works file if user saves the file on his harddisk and then open if but if he directly opens the file from the dialog(by hitting 'Open' button) then file name of the opened excel file comes out be the name of the webform that has the above code and this leads to error in the macro. Is there any option through which i can control the name of the file if user directly opens the file from dialog or the option to disable or remove 'Open' button form the dialog?
[Code]....
In our application, we allow user to upload documents which can be PDF, Doc, XLS, TXT. Uploaded documents will be saved on web server. We need to display link for each document user uploaded and when user click on that link, it should open relevant document. it is expected to have required software to open relevant documents.
To upload document, we use saveAs method of FileUpload control and it works absolutely fine.Now, how to view it?I believe, i need to copy/download file to local user machine and need to open it using Process.Start.For that i need to find user local temp directory. if i put path.GetTempPath(), it gives me web server directory and copy file there.
File.Copy(
sPath + dataReader["url"].ToString(),
Path.GetTempPath() + dataReader["url"].ToString(),
true);
This below code i have used in my aspx page for file download.
Response.AppendHeader("content-disposition", "attachment; filename="" + emailAttachment.FileName + "";");
Response.ContentType = "application/octet-stream";
Response.OutputStream.Write(emailAttachment.Data, 0, emailAttachment.Data.Length);
Response.End();
This block of code display Download file Dialog for Open or Save the attached file.It's working fine in Mozila Firefox and IE8 but doesn't display Download file Dialog box in IE 7
I have made an application where I am displaying the .pdf , .doc , .docx files. These files are uploading from an Admin Panel.When user place a mouse pointer on download icon provided in front of every file, it shows the complete path where it’s get saved.I want to avoid this path visibility even when user place mouse on download icon and even if it Inspect an element (as most modern browser will have this functionality).
View 1 RepliesHow Can I add watermark on video file, What is the best way? I know we can easily do on image. BUt I want on video file.
View 4 RepliesOne of client requires to share and view the .PPT(Microsoft PowerPoint Slides) files online as video, on his web application. I know there are lots of control that plays video online but I want to know is there any active x or api that will recognize the ppt and play it as a video file or do i need build everything from scratch ? For reference you can view [URL].
View 4 RepliesI have a form that will accept and save a MP4 video file. I need to be able to get the dimensions of the video as well. This will be running on a server running ASP.NET 2.0 so any external libs must be able to be placed in the Bin folder as they can not be installed on the server.
how to get the information? If the same lib would let me transcode the video to flv that would be a huge bonus.
Update: The server is XP Service Pack 2 with .NET Framework (2,0,50727,0)
I have a simple 'file download' generic handler which sets the response contenttype and headers before sending the file through the same response.
I also have Response.Cache.SetCacheability(HttpCacheability.server) set in the global.asax.
As I have noticed from various sources, Internet Explorer doesn't like this no-cache setting and gives an error when trying to download the file (requested site unavailable or cannot be found).
I thought maybe I could override this setting in the .ashx page, so I alter the response's cacheability setting to public. This did not solve the issue. removing the line from global.asax does solve the problem but obviously affects the whole site.
Is there a way of setting the cachability just for my generic handler?
In an ASP.NET WebForms 2.0 site we are encountering an intermittent bug in IE6 whereby a file download attempt results in the contents of the being shown directly in the browser as text, rather than the file save dialog being displayed. Our application allows the user to download both PDF and CSV files. The code we're using is:
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.AddHeader("Content-Disposition", "attachment;filename="theFilename.pdf"");
response.ContentType = "application/pdf";
response.BinaryWrite(MethodThatReturnsFileContents());
response.End();
This is called from the code-behind click event handler of a button server control. Where are we going wrong with this approach? Edit Following James' answer to this posting, the code I'm using now looks like this:
HttpResponse response = HttpContext.Current.Response;
response.ClearHeaders();
// Setting cache to NoCache was recommended, but doing so results in a security
// warning in IE6
//response.Cache.SetCacheability(HttpCacheability.NoCache);
response.AppendHeader("Content-Disposition", "attachment; filename="theFilename.pdf"");
response.ContentType = "application/pdf";
response.BinaryWrite(MethodThatReturnsFileContents());
response.Flush();
response.End();
However, I don't believe that any of the changes made will fix the issue.
I'm trying to force a large (200+ MB) file to download that's on a remote server. The problem is that I can't use the "WriteFile()" function, since I'm not using a virtual path. Then, when I try:
Response.AppendHeader("content-disposition",
i need to get thumbnail from video files using C#.
View 1 RepliesI want to capture the frames of a video file through C#. I dont want to use the FrameGrabber or other built dll's. I amlooking it from plain dot net without using COM.
View 2 Repliesis there any method on showing the image for the uploaded video files which are in flv format? i saw all the video in youtube got show the image of the video. how to do it?
View 4 Repliesi have used "embed" tag for Flv file, Flash Player for "swf" file and "object tag for other files.. everything working fine with IE but in Mozilla only swf files working properly.. way to play video of any type in IE and Mozilla both
View 2 RepliesI have a full working web site that i ported to a new hosting company. In some pages i have links to PDF on the server (they do exist!) On the old server no problem. On the new one when user clicks on the link : error 404 file does not exist.. Should i look in the web.config ? i don't know where to start
View 3 RepliesI need to retrieve and save a word document from a xml document ... I can retrieve name, phone number that and all .but i do no how download and save a word document from xml database .
<?xml version="1.0" encoding="utf-8"?>
<registeration>
<Date>
</Date>
<Name>
</Name>
<Qualification>
[Code] ....