Hi Thomas,
You can log the current request URL with log4net using the technique described here
http://stackoverflow.com/questions/187284/log4net-not-logging-threadcontext
Did you have any luck fixing this issue? We have the same problem on a project of ours and it is filling up the error logs and making them useless.
You can use this module to extend the log4net logs:
https://www.coderesort.com/p/epicode/wiki/Log4NetContextInformation
/Steve
Hi there did either of you find a fix for this as we're having the same issue?
Thanks,
Cassandra
I my case I got this error message because there where links to files on external harddrives. But since my solution is an Intranet, that type of links should be allowed for the editors to put in. My solution to this error log spam was to create my own FriendlyUrlRewriteProvider that Inherit from EPiServer.Web.FriendlyUrlRewriteProvider. I Override on method, GetHtmlRewriter(), and call my own FriendlyHtmlRewriteToExternal class that derive from EPiServer.Web.FriendlyHtmlRewriteToExternal class. In my custom FriendlyHtmlRewriteToExternal I Do som extra testing to prevent the exeption from being thrown.
public class FriendlyUrlRewriteProvider : EPiServer.Web.FriendlyUrlRewriteProvider
{
public override HtmlRewriteToExternal GetHtmlRewriter()
{
return new FriendlyHtmlRewriteToExternal(RebaseKind);
}
}
public class FriendlyHtmlRewriteToExternal : EPiServer.Web.FriendlyHtmlRewriteToExternal
{
public FriendlyHtmlRewriteToExternal(UrlBuilder.RebaseKind rebaseKind) : base(rebaseKind)
{
}
protected override bool IsHtmlUrlValidForRewrite(UrlBuilder contextUrl, UrlBuilder url)
{
if (url.Scheme.Equals("file"))
{
/* Added to prevent logfiles filling up with error messages like:
*
* ERROR [5] EPiServer.Web.FriendlyHtmlRewriteToExternal.IsHtmlUrlValidForRewrite - Invalid path encountered: P:/ClueMaxi7.2/clue.exe,
* Exception: System.Web.HttpException: P:/ClueMaxi7.2/clue.exe er en ugyldig virtuell bane.
* ved System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options)
* ved System.Web.VirtualPathUtility.Combine(String basePath, String relativePath)
*/
return false;
}
return base.IsHtmlUrlValidForRewrite(contextUrl, url);
}
}
In addition you will need to add reference to this provider web.config
<urlRewrite defaultProvider="MyFriendlyUrlRewriteProvider">
<providers>
<add name="MyFriendlyUrlRewriteProvider" type="MyProject.Web.FriendlyUrlRewriteProvider,MyProject.Web" />
(EPiServer CMS SDK specify that events like HtmlRewritingUrl can be used for this purpose, but I was not able to figure out how to call these events.)