DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 15 Aug 2007 02:05:55 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Khafancoder
          2    Jesse Houwing am
          3    Khafancoder
                 4    Jesse Houwing am
                 5    Khafancoder
                        6    Jesse Houwing am


Response.WriteFile() Doesn't Trigger Download Managers   
Hi guys,

i am building a FileSharing website,
i wanna allow users to be able using download managers such as DAP to
download files from webserver but
don't allow them to retrive files url...
so i used Response.WriteFile but it won't trigger any download manager
such as DAP or FlashGet

i used this code :


        Response.ContentType = "application/octet-stream";
        Response.AddHeader("Content-Disposition", "attachment;
filename=MyFile.zip");
        Response.AddHeader("Accept-Ranges", "bytes");
        Response.AddHeader("Etag", "\"90a94a56b3bcc71:bea\"");
        Response.WriteFile(file_path);
        Response.End();

Thanks In Advance
Date:Wed, 15 Aug 2007 02:05:55 -0700   Author:  

Re: Response.WriteFile() Doesn't Trigger Download Managers   
Hello Khafancoder,


> Hi guys,
> 
> i am building a FileSharing website,
> i wanna allow users to be able using download managers such as DAP to
> download files from webserver but
> don't allow them to retrive files url...
> so i used Response.WriteFile but it won't trigger any download manager
> such as DAP or FlashGet
> i used this code :
> 
> Response.ContentType = "application/octet-stream";
> Response.AddHeader("Content-Disposition", "attachment;
> filename=MyFile.zip");
> Response.AddHeader("Accept-Ranges", "bytes");
> Response.AddHeader("Etag", "\"90a94a56b3bcc71:bea\"");
> Response.WriteFile(file_path);
> Response.End();
> Thanks In Advance
> 


Usually these download managers don't work if the download originates from 
a postback. Make sure you're using a normal link to the download page. And 
that the download page immediately presents the user with the requested download 
based on the query string information.

--
Jesse Houwing
jesse.houwing at sogeti.nl
Date:Wed, 15 Aug 2007 12:51:57 +0000 (UTC)   Author:  

Re: Response.WriteFile() Doesn't Trigger Download Managers   
Thanks Jesse,

here is what exatcly happening :

my client wants to redirect all users to his domain for downloading
any file from his website...
(in fact he don't want that users be able to download his files from
links which placed in other sites or forums directly)
so we decide to make downloads available by clicking on a button in a
special page (such as RapidShare)
but he also wants his users could use download managers...

Thanks


On Aug 15, 3:51 pm, Jesse Houwing <jesse.houw...@newsgroup.nospam>
wrote:

> Hello Khafancoder,
>
>
>
> > Hi guys,
>
> > i am building a FileSharing website,
> > i wanna allow users to be able using download managers such as DAP to
> > download files from webserver but
> > don't allow them to retrive files url...
> > so i used Response.WriteFile but it won't trigger any download manager
> > such as DAP or FlashGet
> > i used this code :
>
> > Response.ContentType = "application/octet-stream";
> > Response.AddHeader("Content-Disposition", "attachment;
> > filename=MyFile.zip");
> > Response.AddHeader("Accept-Ranges", "bytes");
> > Response.AddHeader("Etag", "\"90a94a56b3bcc71:bea\"");
> > Response.WriteFile(file_path);
> > Response.End();
> > Thanks In Advance
>
> Usually these download managers don't work if the download originates from
> a postback. Make sure you're using a normal link to the download page. And
> that the download page immediately presents the user with the requested download
> based on the query string information.
>
> --
> Jesse Houwing
> jesse.houwing at sogeti.nl
Date:Wed, 15 Aug 2007 08:18:43 -0700   Author:  

Re: Response.WriteFile() Doesn't Trigger Download Managers   
Hello Khafancoder,


> Thanks Jesse,
> 
> here is what exatcly happening :
> 
> my client wants to redirect all users to his domain for downloading
> any file from his website...
> (in fact he don't want that users be able to download his files from
> links which placed in other sites or forums directly)
> so we decide to make downloads available by clicking on a button in a
> special page (such as RapidShare)
> but he also wants his users could use download managers...
> Thanks


you'd have to make a 2-step download. On the landing page (the one with the 
busson) set a flag in the session or set a cookie. Then do a response.redirect 
to the download page, passing the query string parameters again. On the download 
page check if the session variables or the required cookie is there. If it 
is, proceed with the download. If it's not server.transfer back to the landing 
page.

Jesse


> 
> On Aug 15, 3:51 pm, Jesse Houwing <jesse.houw...@newsgroup.nospam>
> wrote:
> 
>> Hello Khafancoder,
>> 
>>> Hi guys,
>>> 
>>> i am building a FileSharing website,
>>> i wanna allow users to be able using download managers such as DAP
>>> to
>>> download files from webserver but
>>> don't allow them to retrive files url...
>>> so i used Response.WriteFile but it won't trigger any download
>>> manager
>>> such as DAP or FlashGet
>>> i used this code :
>>> Response.ContentType = "application/octet-stream";
>>> Response.AddHeader("Content-Disposition", "attachment;
>>> filename=MyFile.zip");
>>> Response.AddHeader("Accept-Ranges", "bytes");
>>> Response.AddHeader("Etag", "\"90a94a56b3bcc71:bea\"");
>>> Response.WriteFile(file_path);
>>> Response.End();
>>> Thanks In Advance
>> Usually these download managers don't work if the download originates
>> from
>> a postback. Make sure you're using a normal link to the download
>> page. And
>> that the download page immediately presents the user with the
>> requested download
>> based on the query string information.
>> --
>> Jesse Houwing
>> jesse.houwing at sogeti.nl

--
Jesse Houwing
jesse.houwing at sogeti.nl
Date:Wed, 15 Aug 2007 15:27:52 +0000 (UTC)   Author:  

Re: Response.WriteFile() Doesn't Trigger Download Managers   
Thank you for reply,


>>Usually these download managers don't work if the download originates from

a postback.

i think because it's a POST request, right ?

so,i change it to a GET request by calling download function in
Page_Load...

but sometimes it trigger download manager and sometimes it doesn't (on
IE), and in firefox download manager never triggered !

of course when i make request to a physical file, in both of them (IE
& FF) DAP will handle the downloads.

so i monitor HttpHeaders diffrence between these requests ("my GET
request" and "calling file directly")  and both of them send the same
request to IIS

and finally ! yes i forget something ! it's because of the .aspx
extension !!! DAP won't handle this extension.

so i used your solution (two pages for downloads) and paste the
extension of requested file -as a querystring parameter- to url of
second page, and it works !

Thank you so much Jesse


i used this code :


        Response.ContentType = "application/octet-stream";
        Response.AddHeader("Content-Disposition", "attachment;
filename=MyFile.zip");
        Response.AddHeader("Accept-Ranges", "bytes");

        Response.WriteFile(path);
        Response.End();
Date:Wed, 15 Aug 2007 11:32:14 -0700   Author:  

Re: Response.WriteFile() Doesn't Trigger Download Managers   
Hello Khafancoder,


> Thank you for reply,
> 
>>> Usually these download managers don't work if the download
>>> originates from
>>> 
> a postback.
> 
> i think because it's a POST request, right ?
> 
> so,i change it to a GET request by calling download function in
> Page_Load...
> 
> but sometimes it trigger download manager and sometimes it doesn't (on
> IE), and in firefox download manager never triggered !
> 
> of course when i make request to a physical file, in both of them (IE
> & FF) DAP will handle the downloads.
> 
> so i monitor HttpHeaders diffrence between these requests ("my GET
> request" and "calling file directly")  and both of them send the same
> request to IIS
> 
> and finally ! yes i forget something ! it's because of the .aspx
> extension !!! DAP won't handle this extension.
> 
> so i used your solution (two pages for downloads) and paste the
> extension of requested file -as a querystring parameter- to url of
> second page, and it works !
> 
> Thank you so much Jesse
> 
> i used this code :
> 
> Response.ContentType = "application/octet-stream";
> Response.AddHeader("Content-Disposition", "attachment;
> filename=MyFile.zip");
> Response.AddHeader("Accept-Ranges", "bytes");
> Response.WriteFile(path);
> Response.End();



You're welcome :)

--
Jesse Houwing
jesse.houwing at sogeti.nl
Date:Wed, 15 Aug 2007 18:29:22 +0000 (UTC)   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us