code not working in v2.7 post upgrade from v2.0

Topics: Themes
Nov 18, 2012 at 11:40 PM

I have this code in the Postview.ascx file:

 <%if (Request.QueryString.Count == 0 && Request.RawUrl.ToLowerInvariant().EndsWith("/default.aspx")) {%>
        <h5 class="posthead"><a rel="bookmark" href="<%=Post.RelativeLink %>"><%=Server.HtmlEncode(Post.Title) %></a></h5>
	    <%} else {%>
        <h2 class="pageTitle"><%=Server.HtmlEncode(Post.Title) %></h2>
	    <%}%>
but since upgrade to v2.7 it does find any url with "default.aspx" and all page title are code with

 

not sure what to do here?

 

Thanks

Nov 18, 2012 at 11:47 PM

Just figured it out

 <%if (Request.QueryString.Count == 0 && Request.Url.ToString().EndsWith("/default.aspx")) {%>
        <h5 class="posthead"><a rel="bookmark" href="<%=Post.RelativeOrAbsoluteLink %>"><%=Server.HtmlEncode(Post.Title) %></a></h5>
	    <%} else {%>
        <h2 class="pageTitle"><%=Server.HtmlEncode(Post.Title) %></h2>
	    <%}%>

Nov 18, 2012 at 11:58 PM

Well that soft of fixed it.  If you are on the home page it work,  if you are on any other "default" page it doesn't work.

Example: 

Viewing the month of November post at the like like "/2012/11/default.aspx"  the

is applied.

Coordinator
Nov 19, 2012 at 4:01 AM

Take a look at DefaultPageRequested method in UrlRules class for example, this method returns true if default page requested taking into account file extension, date part etc.

Nov 21, 2012 at 2:44 AM

Only a small change to get it to work

<%if (Request.Url.ToString().ToLower().Contains("/default.aspx")) {%>
        <h2 class="posthead"><a rel="bookmark" href="<%=Post.RelativeOrAbsoluteLink %>"><%=Server.HtmlEncode(Post.Title) %></a></h2>
	    <%} else {%>
        <h2 class="pageTitle"><%=Server.HtmlEncode(Post.Title) %></h2>
	    <%}%>