AI OnAI Off
I think you should be using HttpRewritingToExternal if you wan't to modify outgoing links.
Actually, i had tried with HttpRewritingToExternal too but the result was the same.
my original link "/images/mypic.gif" was still being converted to "../../images/mypic.gif" (is this what you ment "server controls relocates your paths (link asp:image and img with runat=server)" ?)
If I set default provider for urlRewrite to EPiServerNullUrlRewriteProvider, the link "/images/mypic.gif" is maintained and it's exactly what I want!
Any other ideas?
Here is my code
public class UrlRewriteHandle : System.Web.IHttpModule
{
#region IHttpModule Members
static bool isURLHandlerInitialized = false;
public void Dispose()
{
}
public void Init(System.Web.HttpApplication context)
{
if (!isURLHandlerInitialized)
{
try
{
if (EPiServer.Web.FriendlyUrlRewriteProvider.IsFurlEnabled)
{
UrlRewriteModule.HttpRewriteInit += new EventHandler(UrlRewriteModule_HttpRewriteInit);
}
isURLHandlerInitialized = true;
}
catch
{
isURLHandlerInitialized = false;
}
}
}
static void UrlRewriteModule_HttpRewriteInit(object sender, UrlRewriteEventArgs e)
{
UrlRewriteModuleBase module = sender as UrlRewriteModuleBase;
if (module != null)
{
module.HttpRewritingToInternal += new EventHandler(module_HttpRewritingToInternal);
}
}
static void module_HttpRewritingToInternal(object sender, UrlRewriteEventArgs e)
{
string url = e.UrlContext.InternalUrl.Uri.AbsolutePath.ToLower();
if (url.EndsWith(".jpg") || url.EndsWith(".gif"))
{
e.Cancel = true;
}
}
#endregion
}
Hiue,
Where do you use this link? Do you have runat=server on the component where you set the src attribute? If yes, have you tried using "~/images/mypic.gif"
In the SDK , in the article for Friendly URL mentions that EPiServer CMS Furl rewrites all links in HTML when rendering it to the client. In most case, this is working fine. But I have a situation that I don't want the FURL do anything with my links, specially the src-attribute in the <img>.
Took a look at an article , written by Juwen Jin on the labs.episerver.com (http://labs.episerver.com/en/Blogs/Ruwen/Dates/111218/112064/112154/) and tried to doing that by listen to the event HttpRewritingToInternal
static void module_HttpRewritingToInternal(object sender, UrlRewriteEventArgs e)