November Happy Hour will be moved to Thursday December 5th.

Losing querystring on links

Vote:
 
I have a page on a development site that links back to itself with querystring values and performs actions from the values then navigate to an anchor Link text When I hover over the links i get the following in the status bar: /templates/grouppage.aspx?id=229&epslanguage=EN&cs=01#colours and clicking the links has the desired effect. However when I change the id of the page on the demo site Link text When I hover over the link what i get in the status bar is: /en/page1/page2/ and clicking on the link sends me to the desired page but without providing the desired querystring data Any ideas would be much appreciated
#12622
May 05, 2006 12:42
Vote:
 
I too am having this problem - has any resolution been found ?
#14611
Aug 08, 2006 16:11
Vote:
 
Known bug #45575 There is a workaround if if youre intrested. /HAXEN
#14612
Sep 07, 2006 15:21
Vote:
 
Don't know about anyone else, but I'd be interested in the workaround... /Mark
#14613
Sep 18, 2006 15:37
Vote:
 
Hi all! Yes, workaround would be nice, could someone share his/her knowledge on this one ? /EK
#14614
Nov 03, 2006 13:35
Vote:
 
You create your own class file, inherit from EPiServer.WebControls.FriendlyUrlRegistration, override Render and make the desired changes. Unfortunatly most of the functionality in EPiServer.WebControls.FriendlyUrlRegistration is hidden as Private so you will have to write most of the code over again. Use your own version FriendlyUrlRegistration in your Framework file instead of the EPiServer one. using System; using System.Collections.Specialized; using System.Text; using EPiServer; using EPiServer.Core; using EPiServer.DataAbstraction; using EPiServer.Util; namespace KnowIT.WebControls { /// /// /// public class FriendlyUrlRegistration : EPiServer.WebControls.FriendlyUrlRegistration { private IPageSource _iPageSource; protected IPageSource PageSource() { if (this._iPageSource == null) { this._iPageSource = this.Page as IPageSource; if (this._iPageSource == null) { throw new EPiServerException("This control must be placed on a page that implements IPageSource"); } } return this._iPageSource; } protected override void Render(System.Web.UI.HtmlTextWriter writer) { if((bool) Global.EPConfig["EPfEnableFriendlyURL"]) { writer.Write(this.Framework()); this.ClientScript(); } } protected void ClientScript() { if(FriendlyUrlModule.IsCurrentRequestFriendly) { string url = this.PageSource().CurrentPage.LinkURL; string extension = string.Empty; string query = string.Empty; if((Global.EPConfig["EPsFriendlyUrlExtension"].ToString() == "/") || (Global.EPConfig["EPsFriendlyUrlExtension"].ToString().Length == 0)) { extension = FriendlyUrlModule.PostbackExtension; } if(this.Page.Request.QueryString.Count > 0) { NameValueCollection queries = new NameValueCollection(this.Page.Request.QueryString); queries.Remove("id"); queries.Remove("eplanguage"); query = CreateQuery(queries).ToString(); } this.Page.RegisterClientScriptBlock("FriendlyUrlPostBack", ""); } } internal static StringBuilder CreateQuery(NameValueCollection queries) { StringBuilder query = new StringBuilder(""); foreach(string key in queries.AllKeys) { if (query.Length > 1) { query.Append("&"); } else { query.Append("?"); } query.Append(key).Append("=").Append(queries[key]); } return query; } protected string Framework() { if(Environment.Version.Major < 2) { return ("<base href=\"" + Global.EPConfig.HostUrl + this.Page.TemplateSourceDirectory + "/\" />"); } return string.Empty; } } } /HAXEN
#14615
Nov 07, 2006 13:32
Vote:
 
Hi, I've just quickly scan through your code. Does this mean that it is possible to "modify" the friendly URLs ? e.g. Currently EPiServer generates this Friendly URL: http://localhost/en/Publications/General/News/ Therefore I want to get rid of /General/ in the URL Thanks Danie
#14616
Nov 09, 2006 13:35
Vote:
 
This ONLY modifies the action attribute on the form tag. It only applies when posting a page. If you want to do what I think you want it involves alot more steps. You need to handle the "shortend" url in a HttpModule before EPi does. You need to rewrite all links rendered on the site. I've done it on older versions of EPi and it's alot of work. /HAXEN
#14617
Nov 17, 2006 15:31
* 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.