Developer Forum »
GetUrl() on file-archive-file?
42 posts

I'm using GetUrl(...) on something that inherits from the native ImageFile. The address returned does not work. However, when I go into /edit under the file archive and retrieve the URL from there, it returns a slightly different URL that works. The difference is that the /edit version has '?pid=Native-ContentFile-File' appended to the URL.

What gives? Am I supposed to use GetUrl(...) + "?pid=Native-ContentFile-File" or use some special overload?

 

Thanks,
Emil

181 posts

Hi!

 

GetUrl should always work, without adding anything to it. Could you say something about what you're trying to do?

42 posts

Just trying to get the url to a file so I can download it :)

Accidentally found out what was causing it just now. Apparently, if you have assigned a template in the file-node, the above happens.

Happens in MVC at least. Bet that's what causing it. The Webnodes HttpModule presumably finds a route before checking if the node exists in the file archive?

Will remove the template now as it's not supposed to be there. It was assigned in some cutom WAF-code that will be altered :)

Thanks :)

1