Mono Support Blog posts in search results do not work 

Viewed 11165 time(s), 6 post(s), 2/24/2014 2:54:14 PM - by super
2/24/2014 3:03:58 PM
6018 Reputation 709 Total posts

I have blog container on the homepage.

Initially I posted my issue here on the forums a few months back  that when a user click on blog post on the homepage, the user stays on the homepage and I was told here  that this is by design because of url rewriting rule.

I was advised to change  this:

<rewrite url="^(.*)/(.*)/post/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&$7" name="BlogPost" defaultPage="/Blog.aspx" urlPattern="/{PageName}/post/{Blog.Slug}/{IdentityId}/{Slug}/" />

To this:
<rewrite url="^(.*)/(.*)/post/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/$2.aspx?BlogSlug=$3&BlogPostId=$4&$7" name="BlogPost" defaultPage="/Blog.aspx" urlPattern="/Blog/post/{Blog.Slug}/{IdentityId}/{Slug}/" />

But with this url  rewrite rule, when any user use search option and click on any blog post from the search result, it never redirect the user to that post and gives page not found error.

Page not found
 
We couldn't find the page you requested.
 
 
We couldn't find the page you requested.
 
To continue working with the application please click here

Please advise ? any way I can keep the new url rewrite rule so that I can redirect users to blog page and fix the search result problem ?

1
2/24/2014 3:06:15 PM
6018 Reputation 709 Total posts

Here is the log

2014-02-24 10:07:28,767 [26] ERROR MonoX [BaseHttpApplication] - Application Error
System.Web.HttpException (0x80004005): The file '/search/gridview/%7e/Blog.aspx' does not exist.
   at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)
   at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

2
2/24/2014 4:54:30 PM
1384 Reputation 152 Total posts

Hi super,

Try setting BlogDisplayUrl to empty, as you can see from the error log it doesn't resolve the url correctly with your combination.

<add key="BlogDisplayUrl" value="" />
Regards,
Igor

3
2/24/2014 5:20:41 PM
6018 Reputation 709 Total posts

Hello Igor,

That fixed  the issue - Thank  you

1) Could you please explain what was causing the issue ?

2) What exactly does this solution does by using empty value for blogdisplay ?

4
2/25/2014 4:52:19 PM
1384 Reputation 152 Total posts

1)  Tilde  "&#126;/" at the start of the url wasn't resolved when there is no {PageName} in the urlPattern, if you look at the link "href" it shows url with  &#126;/ so request goes to "{root}/current/directory/&#126;/wrong" instead of "{root}/right"

 2) There's a third option when "BlogDisplayUrl" is empty which resolves "&#126;/" to root.  "BlogDisplayUrl" is passed to rewriter method as the "caller" url. 

5
2/25/2014 6:45:15 PM
6018 Reputation 709 Total posts

Thank Igor.

I have posted a similar issue with Groups: http://www.mono-software.com/Mono/Pages/Discussion/dtopic/SpDhclwnf0KYy6LdAVXKrA/Group-page-do-not-open-from-the-search-results/

Please help ?

6
This is a demo site for MonoX. Please visit Mono Software for more info.