getfile URL request returns 404

s a asked on February 12, 2019 12:18

Hi, I try to request an image by GUID via getfile for example /getfile/2ca48220-81c4-4f1f-91b0-c52d04b037ed/TeaserHeaderImage.aspx which works on my local development machine. After deploying to remote testing server this URL return HTTP state 404. Can someone point me to right direction for configuration setttings which makes the getfile URL method work?

Best regards

Recent Answers


David te Kloese answered on February 12, 2019 13:14

Is the actual file there? Check if your TeaserHeaderImage is actually there with the same permanent url.

0 votesVote for this answer Mark as a Correct answer

s a answered on February 12, 2019 13:34 (last edited on February 12, 2019 13:36)

I do not know what mean "there"? It displays korrect in Kentico Backend Image Text. By the way this is a Kentico 9 question. I forgot this to post. I guess this problem has something to do with some URL rewrite options on the target system.

0 votesVote for this answer Mark as a Correct answer

s a answered on February 12, 2019 13:58

I figured out that the remote Kentico Installation was installed in Kentico9 subfolder. /Kentico9/getfile/2ca48220-81c4-4f1f-91b0-c52d04b037ed/topmood.aspx works as expected. Sorry for the noise.

0 votesVote for this answer Mark as a Correct answer

Muhammad Kaleem answered on February 14, 2019 06:02

Hi David, Can you please help me to get image path from its Guid?

0 votesVote for this answer Mark as a Correct answer

s a answered on February 18, 2019 15:24

Propably there exists a more "Kentico" way. But this method works for me.

public static string imageUrl(string guid, string filename)
{
    string port = null;
    if (HttpContext.Current.Request.Url.Port == 80)
    {
        port = "";
    }
    else
    {
        port = ":" + HttpContext.Current.Request.Url.Port.ToString();
    }


    string result = "//" + HttpUtils.joinUrl(HttpContext.Current.Request.Url.Host + port, "getfile", guid, filename + ".aspx");
    string KenticoBaseRoot = System.Web.Configuration.WebConfigurationManager.AppSettings["KenticoBaseRoot"];
    if (KenticoBaseRoot != null && KenticoBaseRoot.Trim() != "")
    {
        result = "//" + HttpUtils.joinUrl(HttpContext.Current.Request.Url.Host + port, KenticoBaseRoot, "getfile", guid, filename + ".aspx");
    }
    return result;
}
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.