Homepage url rewriting - adding /

Topics: ASP.NET 2.0
Feb 1, 2011 at 3:35 PM

We're running into a problem with our blog when coming from a marketing email that adds google UTM parameters to the link. If you goto the link blog.foobar.com it replaces the url with blog.foobar.com/. If you then add params to the url... blog.foobar.com/?foo=bar , the blog appears empty...no posts.

Suggestions?

Feb 3, 2011 at 2:03 PM

bump

Coordinator
Feb 3, 2011 at 10:54 PM

It looks like if you're using BE 2.0, this problem does not exist.  If you're using a prior version, it can be easily fixed.

In default.aspx.cs, in Page_Load, is code that looks like:

else if (Request.QueryString.Count == 0 || !string.IsNullOrEmpty(Request.QueryString["page"]) ......

Remove the "Request.QueryString.Count == 0 || " part, so it looks like:

else if (!string.IsNullOrEmpty(Request.QueryString["page"]) ......

Untested, but that should do it.

Feb 4, 2011 at 11:58 AM

Thanks Ben, unfortunately that didn't fix it.

I'm not sure what version they are using, is there a config file somewhere that will tell me? I'm not sure theres any possibility of upgrading right now.

Feb 4, 2011 at 12:19 PM

Actually I noticed while playing, that removing the querystring.count portion makes the default site w/o params come up blank too. Not good!

Feb 4, 2011 at 12:34 PM

Got it working by changing it to

Request.QueryString.Count >= 0 

Removing the == 0 would evaluate the rest as False and not get into the loop, so something else had to be there that would evaluate True.

Thanks for getting me in the right direction!