Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / October 2005

Tip: Looking for answers? Try searching our database.

streaming random  filetypes from .aspx

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 20 Oct 2005 20:28 GMT
streaming random  filetypes from .aspx

how to stream a file from inside a .aspx? e.g. so one could go
href="./foo.aspx?file=bar.mp3" or href="./foo.aspx?foo.dat" etc. preferabley
i would like all file types to open with "save as" when href clicked
Keith Patrick - 20 Oct 2005 21:13 GMT
AFAIK, IE considers a streamed file to be an automatic download and thus
requires that the Download bar appears at the top of the browser.  Do stream
a file this way, you basically do this:
this.Response.Clear();
this.Response.ContentType = "<whatever the MIME type is>";
this.Response.AddHeader("Content-Disposition",
"attachment;filename=myfile.txt");
this.Response.Write(...);
this.Response.Flush()

And of course, wrap all that up in a try/catch so you can clean up when
done.

To do what you are asking (link to a file), you'd need to create the file
locally & drop it in a directory visible to the limited ASP user, and create
the link.  Problem with this is setting the lifetime of the file, as it
should be a temp file, but it's hard to know when the file is no longer
deleted (session ends aren't something you can count on being notified of,
as it doesn't happen in a cluster)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.