Portal Engine
Version 3.x > Portal Engine > GetFileURL on different site View modes: 
User avatar
Member
Member
dhanuxz-gmail - 9/4/2009 4:30:57 AM
   
GetFileURL on different site
Hello,

I have two sites installed on my machine. The first site is a public site, while the other site is for internal use and only visible trough our intranet. We would like to have the intranet site to manage the information both for intranet and internet use, so we put all of the document type in the intranet site.

I'm having a problem to show images or file that is attached in the intranet site.

Here's one of the example of the problem. We have a repeater that looks like this:

<cc1:CMSRepeater ID="NewsRepeater" runat="server" EnableViewState="true"
OrderBy="NewsReleaseDate DESC"
SelectedItemTransformationName="CMS.News.NewsDetail" SelectTopN="6"
SiteName="IntranetSite" TransformationName="CMS.News.Latest1" ClassNames="CMS.News" Path="/%" />

This repeater runs on "InternetSite" and it access data in "IntranetSite"

The CMS.News.Latest1 Transformation looks like

<%# IfEmpty(Eval("NewsTeaser"), "", "<img class=thumbz alt=\"" + Eval("NewsTitle") + "\" src=\"" + GetFileUrl("NewsTeaser") + "?maxsidesize=100\" />

and it generates the URL like

http://www.internet-site.com/getattachment/15fa5cf8-388e-4a32-9752-820e0e181a9b/News-Title.aspx?maxsidesize=100

which does not show any image

if i change the url to

http://intranet-site/getattachment/15fa5cf8-388e-4a32-9752-820e0e181a9b/News-Title.aspx?maxsidesize=100

it would show the image but only trough our intranet.

The problem is, we need to run this repeater on our internet site which is visible trough the internet.

Is there's any way to show this image?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 9/7/2009 3:13:37 PM
   
RE:GetFileURL on different site
Hello,

Unfortunately, items in repeater always needs to use domain name of their original site (site where they are placed). You could eventually use 'Linked docs' feature to create 'shortcut' to documents of intranet on your internet site.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
dhanuxz-gmail - 9/11/2009 12:02:25 AM
   
RE:GetFileURL on different site
Hello and thank you for your response.

I've already create a document that linked to the document in the intranet site. But the same problems occurred. The internet site would show the text for the document in the intranet site. But the image just won't shows.

I think the problem is on the getattachment function/method. Or the getFile.aspx

the URL like

http://inter.net/CMSPages/GetFile.aspx?guid=b2d06ca1-4a03-431e-993f-b2d1cac98733

which is placed in our internet site. Just won't link to the attachment in the document that is placed in the intranet site.

The link in our intranet site like

http://intra.net/CMSPages/GetFile.aspx?guid=b2d06ca1-4a03-431e-993f-b2d1cac98733

will work just fine.

The same guid just won't work on different site.

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 9/22/2009 3:05:02 AM
   
RE:GetFileURL on different site
Hello,

Since version 4.1 you can ensure image to be displayed by specifying the name of site with original (not-linked) document into 'SiteName' parameter in query string of URL to image, e.g.:

<%# IfEmpty(Eval("NewsTeaser"), "", "<img src=\"" + GetFileUrl("NewsTeaser") + "?SiteName=NameOfSiteWithOriginalDocument\" />") %>

Best Regards,

Martin Dobsicek