Developer forum

Forum » PIM » Force download for feed

Force download for feed

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

Is it possible to force download of the feed output instead of rendering it in the browser?

I was thinking of something like ?ForceDownload=true

Thank you,

Adrian


Replies

 
Oleg Rodionov Dynamicweb Employee
Oleg Rodionov
Reply

Hi,

The feature seems not yet implemented. You can submit new request here.

BR, Oleg QA

 
Søren Jensen Dynamicweb Employee
Søren Jensen
Reply

Hi Adrian,

Yes, that is possible ..

You can setup a "Scheduled task" with the Add-in "Feed File Export Task", as shown below ..

/Søren

 

 

 

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

Thank you for the responses.

@Søren I know about that feature but in my case the feed is customer-specific. Which means that every customer will have a dynamically generated feed to include customer-specific prices. I cannot use the scheduled task for this.

@Oleg I will submit a feature request.

Thank you,

Adrian

 
Nicolai Pedersen
Reply

You can do that by sending out some http headers that you add in your feed template.

Something like this:

context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
        context.Response.Cache.SetNoStore();
        context.Response.Cache.SetExpires(DateTime.MinValue);

        string contentDisposition = string.Format("attachment; filename=\"{0}\"", Path.GetFileName(context.Request.PhysicalPath));
        string contentLength;

        context.Response.ContentType = "application/octet-stream";
        context.Response.AddHeader("Content-Disposition", contentDisposition);
        context.Response.AddHeader("Content-Length", contentLength);
        context.Response.AddHeader("Content-Description", "File Transfer");

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Thank you for the suggestion.

I was considering IIS Rewrite for that but your solution seems a lot more controllable.

Thank you,
Adrian

 

You must be logged in to post in the forum