Our monthly Virtual Happy Hour is happening this week, Fri Feb 23!

Try our conversational search powered by Generative AI!

Internal URL with query parameters?


I'd like to add query parameters to internal links. Obviously, I'm not able to do that by using "Shortcut to page in EPiServer CMS", as there's no where to edit the URL.

So I tried the same way we used to do it in CMS 6, by using the internal link as an external link; "Shortcut to page on another web site".

However - in 7.5, the links are transformed to Classic Links after clicking Save & Publish.

I try to make a shortcut to: "http://localhost:55807/about-us/news-events/events/"

And after save/publish: "/Views/Pages/NewsPageTemplate.aspx?id=18"

This is by design, according to EPiServer developer support. And thats fine by me, but the editor will get a 404 error when trying to view that page while in edit-mode:

(Normal visitors will not see this error, as they are served the external URL)

I'm wondering if there's a work-around for the 404 page or if there's a better way of linking internal pages w/ query parameters? 


Nov 18, 2014 12:23
<p>Hi &Oslash;rjan,</p> <p>If the problem is restricted to certain pagetypes - would it perhaps be possible to solve this using a custom view for those pages as Linus blogged about here&nbsp;http://world.episerver.com/blogs/Linus-Ekstrom/Dates/2014/4/Adding-custom-views-to-your-content/ ?&nbsp;</p>
Dec 16, 2014 14:40
<p>That is not a bad idea, I'll give it a shot.&nbsp;</p>
Dec 18, 2014 8:02
<p>The problem is not restricted to certain page types, but we do have a "Shortcut" page type which I've added the custom view for.</p> <p>In my custom view I'm now rendering the FriendlyURL for the page targeted with the shortcut in an iframe. This way, edit mode won't take over the request&nbsp;and try to render the page as a Classic url.</p> <p>Here's is what I did:<br /><br /></p> <pre class="brush:csharp;auto-links:false;toolbar:false" contenteditable="false"> [UIDescriptorRegistration] public class ShortcutPageTypeUIDescriptor : UIDescriptor&lt;ShortcutPageType&gt; { public ShortcutPageTypeUIDescriptor() { DefaultView = "shortcutPreview"; AddDisabledView(CmsViewNames.OnPageEditView); } } [ServiceConfiguration(typeof (ViewConfiguration))] public class ShortcutPreview : ViewConfiguration&lt;ShortcutPageType&gt; { public ShortcutPreview() { Key = "shortcutPreview"; Name = "Preview"; Description = "Preview how a visitor will see a shortcut"; ControllerType = "epi-cms/widget/IFrameController"; ViewType = VirtualPathUtility.ToAbsolute("~/EditModeExtensions/ShortcutPreview/ShortcutView.aspx"); } }</pre> <p><br /><br /></p> <p>My custom view:</p> <pre class="brush:html;auto-links:false;toolbar:false" contenteditable="false">&lt;%@ Page Language="C#" Inherits="EPiServer.Shell.WebForms.ContentWebFormsBase" %&gt; &lt;asp:content contentplaceholderid="FullRegion" runat="server"&gt; &lt;iframe src="&lt;%= MyURLFunctions.GetFriendlyUrl(DataFactory.Instance.Get&lt;PageData&gt;(CurrentContentLink)) %&gt;" style="position: absolute; height: 100%; width:95%"&gt;&lt;/iframe&gt; &lt;/asp:content&gt;</pre> <p></p> <p></p>
Dec 18, 2014 10:06
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.