System.UriFormatException: Invalid URI: There is an invalid sequence in the string. exception when going to edit on page with composer

by tomasu 22. April 2010 14:32

Today when we were setting up an old EPiServer 5.1 SP1 site we got some strange errors so I turned on the logging in EPiServer. I got everything to work except for the composer edit on page where I recived the error below.

After doing some debuggning with Reflector Pro inside the EPiServer assembly I realised that it was when EPiServer.Web.PermanentLinUtility.GetPageReference(UrlBuilder mappedUrl) was trying to do some logging it failed. The first thing that this method does is to check for some logging settings and then do some logging.

if (_log.IsInfoEnabled)
{
    _log.InfoFormat("ReparsePageUrl for Url = {0}", (mappedUrl == null) ? "(NULL)" :  mappedUrl.ToString());
}


The part which fails is mappedUrl.ToString().

I haven't bothered to analyze why the ToString() fails. I just turned down the logging so that it won't log that.
If anyone has an idea why it's failing, please comment.

 

Server Error in '/' Application.

Invalid URI: There is an invalid sequence in the string.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UriFormatException: Invalid URI: There is an invalid sequence in the string.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[UriFormatException: Invalid URI: There is an invalid sequence in the string.]
System.Uri.UnescapeString(Char* pStr, Int32 start, Int32 end, Char[] dest, Int32& destPosition, Char rsvd1, Char rsvd2, Char rsvd3, UnescapeMode unescapeMode, UriParser syntax, Boolean isQuery, Boolean readOnlyConfig) +1332
System.Uri.UnescapeString(String input, Int32 start, Int32 end, Char[] dest, Int32& destPosition, Char rsvd1, Char rsvd2, Char rsvd3, UnescapeMode unescapeMode, UriParser syntax, Boolean isQuery, Boolean readOnlyConfig) +73
System.Uri.UnescapeDataString(String stringToUnescape) +152
EPiServer.UrlBuilder.ToString() +15
EPiServer.Web.PermanentLinkUtility.GetPageReference(UrlBuilder mappedUrl) +48
EPiServer.Web.FriendlyHtmlRewriteToExternal.HtmlRewriteUrl(UrlBuilder internalUrl, UrlBuilder externalUrl, UrlBuilder url, Encoding encoding, Object& internalObject) +15
EPiServer.Web.FriendlyHtmlRewriteToExternal.rewritePipe_HtmlRewriteUrl(Object sender, HtmlRewriteEventArgs e) +274
EPiServer.Web.RewritePipe.OnHtmlRewriteUrl(HtmlRewriteEventArgs e) +19
EPiServer.Web.HtmlRewritePipe.WriteElement(MyHtmlRewriteEventArgs e, SgmlReader reader, TextWriter writer) +394
EPiServer.Web.HtmlRewritePipe.RewriteToEnd(TextReader reader, TextWriter writer) +2008
EPiServer.Web.HtmlRewriteStream.Close() +165
System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) +497
System.Web.HttpResponse.FilterOutput() +119
System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +47
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

 

Tags: , , , ,

Development

blog comments powered by Disqus

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 2.5 Sweden License.


Welcome to the Dropit blog!

Here we, the people that work at Dropit, will write about stuff that interests us. For example web development, especially with .NET and EPiServer - but we'll also talk about other techniques that interest us, marketing on the web, social phenomenons, pop culture, games and software development in general.