A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

property to hold internal or external url

Vote:
 

Hi, 

I am using episerver cms 6 R2 edition. I'm looking for a property to hold internal (links to pages in CMS) and external url (external websites...). 

I tried  "propertyUrl" like the following. 

 

[PageTypeProperty(Type = typeof(PropertyUrl),
EditCaption = "Länk för höger topp bild",
SortOrder = 325,
Required = false)]
public virtual string PuffRightTopLink { get; set; }

    

When I'm access the property like this, getting error - Unable to cast object of type 'EPiServer.Core.PageReference' to type 'System.String'.

 

 
<a href="<%= CurrentPage.PuffRightTopLink %>" > </a>

Any help is appreciated. thanks.

  
#75597
Oct 01, 2013 8:30
Vote:
 

If you look at the the property in admin mode, is it set to a property url? Looks like it is set to a PageReference.

PageTypeBuilder will not update the type of a property if you change it in code, that has to be done in the admin area.

#75608
Oct 01, 2013 10:29
Vote:
 
#75610
Oct 01, 2013 10:36
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.