MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Rewrite URLs for Discussion Boards  (Mono Support )

Viewed 12740 time(s), 2 post(s) 12/30/2013 7:16:57 PMby bkkmono
bkkmono

bkkmono

12/31/2013 6:11:04 AM
Hello,

I created my own rewrite rules in web.config: 
<rewrite url="^(.*)/music-sharing$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx" name="MusicDiscussion" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-sharing" />
          <rewrite url="^(.*)/music/(.*)/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?boardId=$2&$4=$5&$7" name="DiscussionPaged" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music/{BoardId}/{Slug}/" />
          <rewrite url="^(.*)/music/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?boardId=$2&$5" name="Discussion" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music/{BoardId}/{Slug}/" />
          <rewrite url="^(.*)/music-share/(.*)/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?topicId=$2&$4=$5&$7" name="DiscussionTopicPaged" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-share/{TopicId}/{Slug}/" />
          <rewrite url="^(.*)/music-share/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?topicId=$2&$5" name="DiscussionTopic" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-share/{TopicId}/{Slug}/" />
          <rewrite url="^(.*)/music-filter/(.*)/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?tftype=$2&$4=$5&$7" name="DiscussionTopicFilterPaged" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-filter/{FilterType}/{Slug}/" />
          <rewrite url="^(.*)/music-filter/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?tftype=$2&$5" name="DiscussionTopicFilter" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-filter/{FilterType}/{Slug}/" />
          <rewrite url="^(.*)/music-filter-tag/(.*)/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?tftype=$2&dbtTag=$3&$4=$5&$7" name="DiscussionTopicTagFilterPaged" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-filter/{FilterType}/{Slug}/" />
          <rewrite url="^(.*)/music-filter-tag/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?tftype=$2&dbtTag=$3&$5" name="DiscussionTopicTagFilter" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-filter/{FilterType}/{Slug}/" />
          <rewrite url="^(.*)/music-message/(.*)/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?dmsgId=$2&dmsgMode=$3&$4=$5&$7" name="DiscussionEditMessagePaged" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-message/{MessageId}/{Mode}/" />
          <rewrite url="^(.*)/music-message/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?dmsgId=$2&dmsgMode=$3&$5" name="DiscussionEditMessage" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/music-message/{MessageId}/{Mode}/" />

They are working fine in the discussion board of my MonoX site.
But when I use the MonoX's search tool to search somethings in the discussion board, an issue occurs in MonoX's search results.
The search tool shows wrong URLs of the discussion board, for example:


It shows the wrong URL 
http://www.mysite.com/search/searchsomething/ [a tilda character (~)] /music-share/fgDN_Sn0AkyO_6KkAIGJtg/NA/?pageno=1&dmsgId=7aP-qUfuiUuiS6KkAIGJtg#Post7aP-qUfuiUuiS6KkAIGJtg


It should be like this
http://www.mysite.com/music-share/fgDN_Sn0AkyO_6KkAIGJtg/NA/?pageno=1&dmsgId=7aP-qUfuiUuiS6KkAIGJtg#Post7aP-qUfuiUuiS6KkAIGJtg


How to fix this issue? Advice me please.



Update: 
I view the source code of the search result page, a result in the search list is like this: 
<div class="search-item">
    <h2><a href='~/music-share/fgDN_Sn0AkyO_6KkAIGJtg/AnExample/' title='an example'>An Example</a></h2>
    <p class="date">30/12/2013</p>
    <p><b>An Example</b></p>
    <p></p>
    <p></p>
</div>
How could I remove the (~) tilda character in the URL?



<div class="search-item">
<h2><a href='/music-share/fgDN_Sn0AkyO_6KkAIGJtg/ยาพิษ-Bodyslam/' title='ยาพิษ - Bodyslam'>ยาพิษ - Bodyslam</a></h2>
<p class="date">30/12/2556</p>
<p>ยาพิษ - <b>bodyslam</b></p>
<p></p>
<p></p>
</div>
<div class="search-item">
<h2><a href='/music-share/fgDN_Sn0AkyO_6KkAIGJtg/ยาพิษ-Bodyslam/' title='ยาพิษ - Bodyslam'>ยาพิษ - Bodyslam</a></h2>
<p class="date">30/12/2556</p>
<p>ยาพิษ - <b>bodyslam</b></p>
<p></p>
<p></p>
</div>
This content has not been rated yet. 
434 Reputation 51 Total posts
khorvat

khorvat

1/2/2014 11:45:54 AM
Can you please confirm if you have the "~" sign like in the code below ?

defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx"
urlPattern="/music/{BoardId}/{Slug}/" 
<rewrite url="^(.*)/music/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?boardId=$2&$5" name="Discussion" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="~/music/{BoardId}/{Slug}/" />
Note: for the "MusicDiscussion" item you will have to do the parsing manually MonoX won't pick that item automatically.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts