Home arrow Forum

Remository Forum

 


Daniel H.

Karma: 0  
automate the download of a file kept in remository - 2010/07/23 11:13 When I try to download a file from our website (which is using Joomla 1.5.15 with Remository 3.52.8) via powershell, an error occurs:

Exception: "the remote server returned an error: (403) forbidden."

The powershell script uses a .net webclient Object. Here's the code snippet:

$DownloadUrl = "http://mywebsite.com/remos/func-download/33/chk,db157b1c1ef7f7c8fee36d9bb462b97c/no_html,1/"
$Filename = "c:TempTest.exe"
$WebClient = New-Object System.net.WebClient
$WebClient.Headers.Add("Cookie", $ie.Document.cookie)
$WebClient.DownloadFile($DownloadUrl, $Filename)

If the URL (as specified in $DownloadUrl) is used manually in the Browser, the download starts and finishes without any problems.

I think the problem is, that the URL does not point to a file but to a remository function instead.

I will be thankful for any hint, how to download the file using powershell.

Post edited by: Daniel H., at: 2010/07/23 14:05
  | | Sorry, you do not currently have permission to write here.
admin

Karma: 98  
Re:automate the download of a file kept in remository - 2010/07/23 18:53 Hard to be sure, I don't know much about .net.

You can't use a URI of that kind with wget because wget tries to interpret it as a conventional file specification, and it doesn't really look like one.

It works for a browser, because the file is sent, preceded by suitable headers. But it isn't guaranteed to work in other contexts, I'm afraid.
Martin Brampton aka Counterpoint
http://aliro.org
http://black-sheep-research.com
  | | Sorry, you do not currently have permission to write here.

Login

Subscribe to Premium Support

Get priority support for Remository and Glossary, sign up now for a Premium Support monthly subscription:

Your Remository user name

Or purchase a year's support:

Your Remository user name

Recommended SEF

SEF Advance

Who is Online

Remository welcomes guests and visitors

We have 11 guest online