paths with tilde (~) returning 404

mun yung kan asked on March 14, 2016 10:16

Hi Guys,

i'm trying to get attachments from my page, namely the MenuItemTeaserImage.

i'm basically using CMS.DocumentEngine.AttachmentURLProvider.GetAttachmentUrl(imageGuid, nodeAlias)

it returns a path with the tilde (~) at the front, but any requests with a tilde in the url basically returns a 404. remove the tilde, and the image renders just fine

anyone else got advise? i've followed instructions from here, but noticed the article is kind of old as i am using kentico 9 currently.

Correct Answer

Anton Grekhovodov answered on March 14, 2016 15:51

Hi,

You need to use URLHelper.ResolveUrl method which converts relative URL to absolute

3 votesVote for this answer Unmark Correct answer

Recent Answers


Trevor Fayas answered on March 14, 2016 14:43

I've run into issues with the ~ as well. Often time i just do a .replace("~","") to make sure it's gone, but i'm hoping someone else will chime in with a possibly better alternative.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 14, 2016 22:30

I've had this issue with upgrading to version 9.x and installing new sites in 9.x. The article you referenced mun yung kan will resolve your issue, even for version 9.

0 votesVote for this answer Mark as a Correct answer

mun yung kan answered on March 15, 2016 02:29

Hey brenden,

i've followed all the steps in the article (except step 2, the class doesnt seem to exist in version 9).

i'm still getting errors with the tilde character, i'll just remove the tilde from the paths for now, but i'd still love to be able to solve this one.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 18, 2016 03:10

mun yung kan, step 2 isn't needed in v8 or v9. Also make sure the references in step 4 are correct for v8 and v9 (easiest to copy from a fresh install of v8 or v9). I just went through it this evening with a site and had no issues.

1 votesVote for this answer Mark as a Correct answer

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