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 27399 time(s), 7 post(s) 07.11.2013 01:20:29by bkkmono

Related topics

bkkmono

bkkmono

07.11.2013 01:21:30
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?

Dieser Inhalt wurde noch nicht bewertet. 
434 Reputation 51 Total posts
mzilic

mzilic

07.11.2013 11:55:18
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
Dieser Inhalt wurde noch nicht bewertet. 
2218 Reputation 300 Total posts
bkkmono

bkkmono

07.11.2013 14:41:36
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>



Dieser Inhalt wurde noch nicht bewertet. 
434 Reputation 51 Total posts
mzilic

mzilic

07.11.2013 14:58:45
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
Dieser Inhalt wurde noch nicht bewertet. 
2218 Reputation 300 Total posts
bkkmono

bkkmono

07.11.2013 16:46:44
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.
Dieser Inhalt wurde noch nicht bewertet. 
434 Reputation 51 Total posts
mzilic

mzilic

07.11.2013 16:39:48
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
Bewertet mit 5,00, 1 Besucher. 
2218 Reputation 300 Total posts
bkkmono

bkkmono

07.11.2013 17:41:33
Thank you. I will learn and try to create my own web part as your suggestion.
Dieser Inhalt wurde noch nicht bewertet. 
434 Reputation 51 Total posts