create and stream text file on the fly

G

Guest

Hello!

Please, could you tell me, is it possible to create and stream for example a
text file to the browser so that the file is not stored anywhere on a hard
drive?

User click's a link, eg. http://my.domain.com/apps/app/page.aspx?docID=235
and then the text file opens with a text "235" and when the user closes the
file there is not track of the file anywhere on a hard drive.

Your help is very much appreciated!

Thanks.

Peter
 
G

Guest

Hello Peter,

As an idea, could you not use a cookie or session? What are you trying to do?

Thanks,

Jon
 
G

Guest

Hello John!

Thank you for reply.

We have Documents management system and it's client application installed on
every machine. There is document number property in database which identifies
all documents and can be used to open all documents in user's machine.

I can create a text file with .DRF extention (eg. mydoc.drf) and there is
one row inside this .DRF file and it goes like this:
"DOCUMENTSLIB;DOCUMENTS;123456" where "123456" is a document number. When
user doubleclicks this DRF file, document whith document number 123456 is
opened by DM System's clien app. Now I need to extend this functionality to
the browser. For example I can retrieve all user's documents (documents
number and documents name) which are stored in the system to the DataGrid
contorl and now I need to create this .DRF file on the fly and stream it to
the browser so that DM System's clien application opens it.

Now I have over 500 000 .drf files, created with for loop, stored on a hard
drive and links to those files, but I think this is not very sophisticated
way to resolve the problem.

Peter
 
E

Elton Wang

Hi Peter,

If you are sure the file is text file, you can use
following code:

Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "text/plain";
Response.Charset = string.Empty ;
string path = GetFilePath() ; // here you need find out
file path you want to open.
this.Response.WriteFile(path);
this.Response.End();

The question is how do you access the files in client
machine. If you run the application in Intranet, you might
need give ASPNET permission to access those files.

Hope it's helpful.

Elton Wang
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top