Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

How do I get the URL's (and Page information in general) which the user may use to visit a page from a tab in Edit Mode



I'm new to EPiServer and I'm trying to create a module which extends the edit view to include a tab with some extra information about a page. Part of this information should be the URL(s) which the user may use when visiting the page. I am a bit lost and would really appreciate some help from someone more experienced with EPiServer.

My environment is:

  • Visual Studio 2008
  • I'm Targeting .NET 2.0
  • EPiServer 5 R2

What I have done is:

  1. Add new item on the project
  2. GUI Plugin named MyEditTab of type EditPanel

I get this code behind file:

using System;
using System.Collections.Generic;
using System.Web.Security;
using System.Web.UI.WebControls;
using EPiServer.Personalization;
using EPiServer.PlugIn;
using EPiServer.Security;
using EPiServer.Util.PlugIns;
using System.Web.UI;

namespace MyProductsNameSpace
    [GuiPlugIn(DisplayName = "MyEditTab", Description = "Edit panel description", Area = PlugInArea.EditPanel, Url = "~/MyEditTab.ascx")]
    public partial class MyEditTab : System.Web.UI.UserControl
       // TODO: Add your Plugin Control Code here.

And this front file after I changed AutoEventWireup to True:

<%@ Control Language="c#" Codebehind="MyEditTab.ascx.cs" AutoEventWireup="True" Inherits="SiteSeeker.MyEditTab" %>

<!-- TODO: Add markup for the plugin here -->

My questions:

  1. How do I "get information" (if there are multiple ways and interesting information I would be eager to know more) about the page which the tab is tied to in Edit Mode from the code behind file?
  2. And more specifically. How do I get the URL(s) which the user will visit when viewing the page from the code behind file? As this is for a module I need it to work regardless of web.config settings.

Many thanks for reading! I hope somone will give me a tip.


Mar 17, 2010 17:45

You could probably get the page ID from Request.QueryString "id" parameter. Get the corresponding PageData and you have your non-FURL in the LinkURL property. You can then use something like this to get the FURL:

UrlBuilder furl = new UrlBuilder(page.LinkURL);
Global.UrlRewriteProvider.ConvertToExternal(furl, page.PageLink, System.Text.UTF8Encoding.UTF8); 

If the page has a simple address you can get it from the "PageExternalUrl" property.

Of course you'd have to find a way to skip all of this if the page edited is a new page.

Mar 18, 2010 7:44
* 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.