Can Stream A File In C#
Dec 20, 2010
Assume we have the access to sth.avi on [URL] with a direct link.
e.g : [URL] Also we have a website => www.dl2.com.
Now, we wanna let some users to download sth.avi from [URL], but we don't have enough space on [URL] to save sth.avi. Is it possible in ASP.NET for us to read sth.avi from www.dl.com as streaming file and share it without saving the file on our domain.
P.S: I don't wanna share this link [URL], actually I wanna share something like this link [URL]
View 3 Replies
Similar Messages:
Feb 22, 2011
I have an excel file in my Response Output stream. I can Open the stream as a file after a prompt, but it doesn't seem I can save it directly to a specified folder on my client.
View 1 Replies
Jul 19, 2010
i will be passing the xml file like this:
[code]....
error:
Error 1 The best overloaded method match for 'System.Xml.Linq.XDocument.Load(string)' has some invalid arguments
cannot convert from 'System.IO.Stream' to 'string'
View 2 Replies
Aug 29, 2010
I have made a WCF web service that streams a 200 mb zip file. how i can read this stream at my client and then give option to the user to download that
View 1 Replies
Feb 15, 2010
I have a DataTable that i want to convert it to xml and then zip it, using DotNetZip. finally user can download it via Asp.Net webpage.
My code in below
dt.TableName = "Declaration";
MemoryStream stream = new MemoryStream();
dt.WriteXml(stream);
ZipFile zipFile = new ZipFile();
zipFile.AddEntry("Report.xml", "", stream);
Response.ClearContent();
Response.ClearHeaders();
Response.AppendHeader("content-disposition", "attachment; filename=Report.zip");
zipFile.Save(Response.OutputStream);
//Response.Write(zipstream);
zipFile.Dispose();
the xml file in zip file is empty.
View 6 Replies
Mar 16, 2010
I have a url that points directly to a wav file. Id like to extract the file from the url and save it to a file on our file system.
View 2 Replies
Mar 19, 2011
I am trying to filestream to my hosting Companies sever.I have tried the below expecting it would not work. How can I find the correct path.Could not find a part of the path 'C:ERAPDFERA202.60.64.136.1.pdf'.
Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:ERAPDFERA202.60.64.136.1.pdf'.
Source Error:
[Code]....
View 2 Replies
Sep 23, 2010
I changed an app so one of the edit screens opens as a pop-up window via showModalDialog. Previously everything was done in the same window and more back and forth navigation was required. The pop-up provides greater continuity. Unfortunately, as a pop-up, files will not stream to the desktop. If I bring up the page by entering a URL on the address line, so it is not a pop-up, files stream to the desktop OK.
Streaming a file to the desktop is done as follows:
[Code]....
This causes an open/save/cancel dialog to appear in the browser. Does anyone have an idea why a file cannot be streamed to a pop-up window? To get pop-ups to work I always include
[Code]....
in the header. That way I can open other pop-ups such as warnings and database error messages from a prvious pop-up.
View 1 Replies
Jul 28, 2010
I don't think there is a way around this but figured I'd ask... We have an application where a user can generate PDF documents that are streamed to the browser. There is some additional functionality going on behind the scene and I would like to be able to display a message to the user (via updating a literal tag on the page). I don't get any errors when doing this but the page isn't updated and the message isn't displayed. My guess is that streaming the document blocks any other content from going down to the client. In particular, we're using CeTe Dynamic PDF and calling one of their methods but I think it's essentially just doing a Response.BinaryWrite to stream out the PDF.
View 6 Replies
Aug 31, 2010
I have a wcf service that is used to download files. Its working alright (finally), but i can see that when it downloads the CPU usage goes around 75%.Client Code
FileTransferServiceClient obj = new FileTransferServiceClient();
Byte[] buffer = new Byte[16 * 1024];
CoverScanZipRequest req = new CoverScanZipRequest(
[code]...
View 1 Replies
Feb 22, 2010
When user requests to download a document, I'm writing out a PDF file to HttpResponse using HttpResponse.OutputStream.Write method. It works in every browser except Firefox(3.5.8). In Firefox it sometimes displays the file and sometimes it displays the actual byte stream. When it displays a byte stream, http response is never finished. I see 'transferring data' status and the byte stream ends with EOF. After some time, I get 'connection was reset' window.
Here is response header:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 103185
Content-Type: application/pdf
Expires: -1
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
Content-Description: stuff.pdf
Content-Disposition: inline;filename="stuff.pdf"
X-Powered-By: ASP.NET
Date: Mon, 22 Feb 2010 16:15:38 GMT
View 5 Replies
Jan 22, 2011
I wrote an ASP.Net web page that will take a QueryString and stream a file to the client. The file is stored in a SQL Server database. Everything works great when I'm running the web site locally during development. When I run it in production from the server I can get a file through Firefox, but not Chrome. In Chrome I get Error 100 (net::ERR_CONNECTION_CLOSED): Unknown error.See some other posts that mention this could be related to Content-Length, however, I can't understand why this would work in development and not production. For that reason I think there must be something else going on here.Here is my code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Data_ID As String = Request.QueryString("Data_ID")
Using dt As New Enterprise_Error_Log.Field_FileDataTable
[code]...
View 1 Replies
Oct 8, 2010
I have a third party CMS system that can create forms but can't manage true File upload capabities. I am able to get users brows for thier file and have the value submited to my custom .net code behind page for processing. So I end up with like "C:somefilefoldersomefile.doc".
But on my processing page I want to read this file (like the file uploader) and save it to a location. I tried using the file uploader control (but have it not visible) but realized I can't preset it as I was planning to set it and do the normal processing from there. Is there another way to do this?
View 3 Replies
May 20, 2010
I'm using Filestream for read big file (> 500 MB) and I get the OutOfMemoryException. Any solutions about it?? I want this in my app asp.net: Read DATA from Oracle Uncompress file using FileStream and BZip2 Read file uncompressed and send it to asp.net page for download. When I read file from disk, Fails !!! and get OutOfMemory. My Code is:
using (var fs3 = new FileStream(filePath2, FileMode.Open, FileAccess.Read))
{
byte[] b2 = ReadFully(fs3, 1024);
}
// [URL]
public static byte[] ReadFully(Stream stream, int initialLength)
{
// If we've been passed an unhelpful initial length, just
// use 32K.
if (initialLength < 1)
{
initialLength = 32768;
}
byte[] buffer = new byte[initialLength];
int read = 0;
int chunk;
while ((chunk = stream.Read(buffer, read, buffer.Length - read)) > 0)
{
read += chunk;
// If we've reached the end of our buffer, check to see if there's
// any more information
if (read == buffer.Length)
{
int nextByte = stream.ReadByte();
// End of stream? If so, we're done
if (nextByte == -1)............................
View 8 Replies
Jan 20, 2011
I have an httpmodule and it has a handler for OnEndRequest. I am trying to write the HttpContext.Response.OutputStream to a file. I am trying to use the Read method of it. But when it is called the exception message i get is "Specified method is not supported". So i am not able to do what i want that is, write the response to a file on the disk. I am able to write the HttpContext.Request.InputStream to a file using its Read method which i do in a handler for OnBeginRequest.
View 2 Replies
Feb 15, 2011
I need to to export a file to the user. It takes 1-2 min to generate the file so I'd like to have the page go into a kind-of modal mode with a layover on the page and a 'Working' spinner showing. The problem is I can't make the modal stuff go away after Save File dialog is closed.
How can I remove the layover after the dialog is done?
View 1 Replies
Mar 25, 2010
I'm working on a web app and need to stream various files. I can do pdfs, images, and older Office documents. However, when I try to do with 2007 documents, it breaks. Here is my code:
Response.Buffer = true;
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
switch (FileExtension.ToLower())
{
case "pdf":
Response.ContentType = "application/pdf";
break;
case "doc":
Response.ContentType = "application/msword";
break;
case "docx":
Response.ContentType = "application/vnd.ms-word.document.12";
break;
case "xls":
Response.ContentType = "application/vnd.ms-excel";
break;
case "xlsx":
Response.ContentType = "application/vnd.ms-excel.12";
break;
default:
Response.ContentType = "image/jpeg";
break;
}
Response.BinaryWrite(buffer);
The error that I get is:
An invalid character was found in text content. Error processing resource 'http://DomainName/GetFile.aspx.
View 2 Replies
Jun 29, 2010
1) I notice that the module gets it's data in chunks. This is problematic for me because I'm using a regex to find and replace. If I get a partial match in one chunk and the rest of the match in the second, it will not work. Is there any way to get the entire response before I do my thing to it? I have seen code where it appends data to a string builder until it uses a matches on an "" end tag but my code must work for more that just (xml, custom tags, etc). I don't know how to detect the End Of Stream or if that is even possible.
View 1 Replies
Nov 10, 2010
I'm trying to return an xml string from a IHttpHandler to a like this: context.Response.Write(xml); When I receive the response in my .aspx.cs I try to load the document as follows: var xml = XDocument.Load(xmlString); but I get an Illegal Characters in Path error message. I've also tried
context.Response.Write(context.Server.HtmlEncode(xml));
and
var xml = XDocument.Load(Server.HtmlDecode(xmlString));
but I get the same message. Is there any way I can return XML from my IHttpHandler?
View 3 Replies
Dec 16, 2010
I am looking to add video stream into my web application for webcams.owever, I have never used the .NET framework to do so. Any ideas were I should start?
View 9 Replies
Jun 18, 2010
I have a working solution on an IIS6, which I made using this guide: FLV Flash video streaming with ASP.NET 2.0, IIS and HTTP handler
The app is basically a FLV Player, but streaming is essential to it.
Now, one of our customers is running IIS7 and the streaming doesn't work.
View 2 Replies
Nov 11, 2010
byte[] bytes = new byte[uploader.UploadedFiles[0].InputStream.Length];
uploader.UploadedFiles[0].InputStream.Read(bytes, 0, bytes.Length);
var storedFile = new document();
string strFullPath = uploader.UploadedFiles[0].FileName;
string strFileName = Path.GetFileName(strFullPath);
storedFile.document_id = Guid.NewGuid();
storedFile.content_type = uploader.UploadedFiles[0].ContentType;
storedFile.original_name = strFileName;
storedFile.file_data = bytes;
storedFile.date_created = DateTime.Now;
db.documents.InsertOnSubmit(storedFile);
db.SubmitChanges();
If:
Reading from a stream in a single call to Read is very dangerous. You're assuming all the data will be made available immediately, which isn't always the case. You should always loop round, reading until there's no more data.
How should I change the above code to make it 'less dangerous'?
View 1 Replies
Jan 18, 2010
I have a website built in ASP.NET 2.0 and a Windows Server 2003 server streaming live videos with Windows Media Services.
To play the content i usually embed a Windows Media Player in my page and make it open the publication URL (let's say http://my.server.com/live), and it works fine.
The problem is that when no stream is playing, an empty stopped player appears and i don't like that
So i'd like to check in my (VB) code if there's actually something being streamed BEFORE i open the player, and display a 'no active stream right now, please try later' message instead.
View 5 Replies
Dec 9, 2010
I want to store .flv files in the database and not in the file system.
This is what I can do right now: Successfully convert .wmv and .mpeg to .flv with ffmpeg. Store images in SQL Server and show them on my page with an httphandler. Same with .avi and .mpeg videos. (It's up to the user's software if he can view it though) Play .flv files in the browser if the file is located in the file system and not in the database.
What I can't do is: Stream .flv videos to JW Player directly from the database. (Stored as binary data)
I've searched the internet for two days now but I can't get it to work. It feels as if I'm almost there though. The JW Player opens up and starts to "buffer", but nothing happens.
I know there's no easy answer but if anyone has done this before, or something similar, I'd like to know how you did. I feel I've got too much code to post it all here.
View 3 Replies
Feb 19, 2011
public void ZipExtract(Stream inputStream, string outputDirectory)
{
using (ZipFile zip = ZipFile.Read(inputStream))
{
Directory.CreateDirectory(outputDirectory);
zip.ExtractSelectedEntries("name=*.jpg,*.jpeg,*.png,*.gif,*.bmp", " ", outputDirectory,
ExtractExistingFileAction.OverwriteSilently);
[Code]....
I try to read zip archive from stream and extract files. Got the following exception in the line "using (ZipFile zip = ZipFile.Read(inputStream))" : ZipEntry::ReadDirEntry(): Bad signature (0xC618F879) at position 0x0000EE19. how to handle this exception?
View 2 Replies