volume_up

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. 

volume_up

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. 

Omskrivning av URL:er

Det har skett en förändring i hur URL:er hanteras, bl.a. annat så kodas de om på annat sätt än tidigare och EPiServer skriver om länkar som tidigare ej påverkades. Finns det något sätt att påverka eller komma runt detta?
#15654
Apr 16, 2007 10:59
Summary in english: You asked if you can change the behaviour of EPiServer CMS, so that it does not rewrite selected URL:s to Friendly URL:s. And yes, it is possible to override this feature. And it is also possible to enhance it. Or turn it off completely if you like (in web.config). To get an overview over the different possibilities you have, I provide a code sample that can be used to move the ViewState-section to the end of the streamed HTML. By looking through this sample, you can hopefully also get ideas of how to manage you own URL:s so that they will not be modified. You will basically only need to listen to some events and descide what to do when your URL:s are to be managed. You can also get more information of this area within the SDK provided in the CTP-package. Here is the Sample. #region Copyright © 1997-2007 EPiServer AB. All Rights Reserved. /* This code may only be used according to the EPiServer License Agreement. The use of this code outside the EPiServer environment, in whole or in parts, is forbidden without prior written permission from EPiServer AB. EPiServer is a registered trademark of EPiServer AB. For more information see http://www.episerver.com/license or request a copy of the EPiServer License Agreement by sending an email to info@episerver.com */ #endregion using System; using System.Data; using System.Configuration; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Xml; using EPiServer.Core; using EPiServer.PlugIn; using EPiServer.Web; namespace EPiServerSample.templates.Units { /// [PagePlugIn()] public class ViewStateMover { /// /// public static void Initialize(int optionFlag) { HtmlRewritePipe.HtmlInit += HtmlInitEventHandler; } /// /// The sender. /// The
#16062
Apr 16, 2007 14:28
Thanks for the example, but it's not quite what i want. I don't want to modify the page, just prevent EPiServer from modifying some specific URL's. I've tried to hook on to these events UrlRewriteModule.RewriteValidateHtmlRewrite UrlRewriteModule.RewriteValidateToExternal UrlRewriteModule.RewriteValidateToInternal and setting e.IsValidForRewrite to false, but that doesn't seem to work. If I remove the UrlRewriteModule httpModule everything works just fine, but as i said i only want to turn it off for certain URL's.
#16063
Apr 18, 2007 9:33
OK. Here is some code that could perhaps help you. It hooks into UrlRewriteModule and prevents the URL-rewritting on a Ult-by-URL-basis. using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using EPiServer.Core; using EPiServer.PlugIn; using EPiServer.Web; namespace EPiServer1 { [PagePlugIn()] public class UrlRewriteControl { public static void Initialize(int optionFlag) { UrlRewriteModule.RewriteInit += new EventHandler
#16064
Apr 20, 2007 10:49
I've tried exactly what you suggest but i still get me URL's messed up. Í have hooked up to all the events in UrlRewriteModule and set e.IsValidForRewrite = false; When debugging I can see that the eventhandler is called for the specified URL's but this doesn't seem to help. If i have UrlRewriteModule activated and try to stop it from rewriting the URL as stated above I get the following. If i remove the UrlRewriteModule from web.config i get. Note that the & is replaced by & Is there anyway we could work around this?
#16065
Apr 26, 2007 9:25
Any suggestions?
#16066
May 02, 2007 12:01
Hello, The encoding of '&' as '&' is correct - the reason this occurs when UrlRewrite is enabled is because it will always parse the outgoing HTML and when regenerating the URL it will HtmlAttributeEncode it, which is correct behavior. As far as I can determine from the sample provided, the real problem is that the URL in the first place is emitted with an undefined entity in the attribute string: '&a=...'. That this works at all is because ASP.NET silenty ignores the error. It's still incorrect HTML as far as I know. If you are using the attribute internally in your code directly, you should always do a System.Web.HttpUtility.HtmlDecode before using it to ensure that any entity encodings are resolved before applying for example System.Web.HttpUtility.ParseQueryString to get at the actual parameter values. When running as a Page, all the appropriate properties are set accordingly, thus you can use Request.RawUrl, Request.QueryStrings and Request.Params without any HtmlDecode. I guess that the situation is actually more complex than what meets the eye, so if you can please give us further details of why the correct entity encoding is problematic we can give further help. We are also considering whether we should change the meaning of the IsValidForRewrite to really, really leave the URI untouched, as that may be more intuitive and possibly necessary in some case we've not yet forseen. The solution in this case is probably for you to perform a HtmlDecode.
#16067
May 07, 2007 14:40
error 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.