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.

How to Rewrite the URL of "Back To All Discussion Boards" link?  (Mono Support )

Viewed 14936 time(s), 7 post(s) 11/7/2013 1:20:29 AMby bkkmono

Related topics

bkkmono

bkkmono

11/7/2013 1:21:30 AM
Hello,

I read the previous posts about rewriting URLs of a discussion board in MonoX to create SEO-Friendly URLs, then I wrote my own rewrite tags in web.config, everything works fine. For instance, 

<
rewrite url="^(.*)/mynewboard/(.*)/(.*)/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?boardId=$2&$4=$5&$7" name="DiscussionPaged" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/mynewboard/{BoardId}/{Slug}/" />
 <rewrite url="^(.*)/mynewboard/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?boardId=$2&$5" name="Discussion" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/mynewboard/{BoardId}/{Slug}/" />

However, I have a problem when I am on a discussion board page. The "Back to All Discussion Boards" link is still linked to page: "http://www.mydomain.com/MonoX/Pages/SocialNetworking/Discussion.aspx?=", not be the rewritten url.

I tried to write my own rewrite tag for Discussion.aspx like this: 
<rewrite url="^(.*)/mydiscussion$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx" name="MyDiscussion" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/mydiscussion" />
When I browse to "http://www.mydomain.com/mydiscussion", it works fine by displaying the Discussion.aspx but the "Back to All Discussion Boards" link is still linked to "http://www.mydomain.com/MonoX/Pages/SocialNetworking/Discussion.aspx?=".

How to Rewrite the URL of "Back To All Discussion Boards" link?

This content has not been rated yet. 
434 Reputation 51 Total posts
mzilic

mzilic

11/7/2013 11:55:18 AM
Hello,

The Back to all discussion boards link takes into account current request to generate a link back. You could create a custom control and OnPreRender set a different link.

Regards,
Mario
This content has not been rated yet. 
2218 Reputation 300 Total posts
bkkmono

bkkmono

11/7/2013 2:41:36 PM
How could I do that? Please suggest me more.

However, I just solved this on my own. I changed the link of the Back to All Discussion Boards by adding client script in Discussion.aspx like the following Javascript code:
<script type="text/javascript">
       document.getElementById("client_id").href="/my_new_discussion_rewrite_page";
</script>



This content has not been rated yet. 
434 Reputation 51 Total posts
mzilic

mzilic

11/7/2013 2:58:45 PM
Hello,

That is one way to resolve your problem. The solution I proposed would require you to create a new discussion topic web part(s) which inherit MonoX's discussion topic web part(s). In your inherited discussion topic web part(s) you could set the lnkBack NavigateUrl property. Finally just change the Register declarations to point towards your custom web part(s).

Regards,
Mario
This content has not been rated yet. 
2218 Reputation 300 Total posts
bkkmono

bkkmono

11/7/2013 4:46:44 PM
Would it require to have the full MonoX source code to create a web part?
I can't compile to create a new web part from the free version of MonoX.
This content has not been rated yet. 
434 Reputation 51 Total posts
mzilic

mzilic

11/7/2013 4:39:48 PM
No. You'd just need to create a custom discussion page and inherit MonoX's discussion page as well and change relevant Register declarations. The following applies if you followed this tutorial on how to create a custom MonoX based project: http://www.mono-software.com/blog/post/Mono/95/Building-a-custom-ASP-NET-project-based-on-MonoX/

Regards,
Mario
Rated 5.00, 1 vote(s). 
2218 Reputation 300 Total posts
bkkmono

bkkmono

11/7/2013 5:41:33 PM
Thank you. I will learn and try to create my own web part as your suggestion.
This content has not been rated yet. 
434 Reputation 51 Total posts