URL Rewrite problem with Blogengine.net

Topics: ASP.NET 2.0
Feb 2, 2012 at 10:44 PM

IIS7 with URL rewrite - doesn't work with blogengine.net

I have a tag entry for example

/news/?tag=/John+Smith/

Which I url rewrite to /John Smith/

 

The rewrite works fine but  the /John Smith/ has not data behind it

 assume the page is not getting generated - any ideas ?

 

 

 

Feb 3, 2012 at 1:20 AM

You're doing something in IIS7 to change BlogEngine.NET's rewriting? So a BE.NET url of /news/?tag=/John+Smith/ DOES work, but not after an IIS7 server rewrite config change?

When you say, "no data behind it," do you mean the page is blank or there aren't any posts?

fwiw, the "tags" querystring is handled in /default.aspx.cs if you want to step through that processing point.

Good luck,
Dave

 

Feb 3, 2012 at 2:45 PM

correct there is no pages behind the tag  /John Smith/ - even though it's been rewritten 

 

I'm wondering is there a way to "pre-compile" the tags ? 

 

would categories work better ?

Feb 3, 2012 at 10:09 PM

A page processed through 2 rewrite logics is bound to cause headaches.  You may want to make your rewriting modifications directly in BE.NET, since it is already performing url rewriting.  Url Rewriting can be a tricky thing...

Feb 6, 2012 at 4:17 PM

how would I do url rewriting directly in be.net ?

Coordinator
Feb 6, 2012 at 5:31 PM

You probably getting into conflict with existing BE URL rewrite module (core/web/httpmodules) which also rewrites tags:

private static void RewriteTag(HttpContext context, string url)
{
    var tag = ExtractTitle(context, url);

    if (url.Contains("/FEED/")) {
        context.RewritePath(string.Format("syndication.axd?tag={0}{1}", tag, GetQueryString(context)), false);
    }
    else {
        context.RewritePath(
            string.Format("{0}?tag=/{1}{2}", Utils.ApplicationRelativeWebRoot, tag, GetQueryString(context)), false);
    }
}