I need to change the way MVC is rendering action links(and form's and url's, etc) based on a configuration setting. I am writing a facebook application using MS MVC and my action links need to render link so:
<a href="/MyFBApplication/Home/Index/">home</a>
clicking the above link would browse to:
http://apps.facebook.com/MyFBApplication/Home/Index/
"MyFBApplication" is the name of the facebook application. To build the link I started by calling
Html.ActionLink("Home", "Index", "Home")
When a user click the link facebook will then make a request to this link under the covers:
http://www.myapplicationserver.com/facebook/123456/Home/Index/
(123456 is client id and is needed)
Then response from here is processed by facebook and displayed to the user as:
http://apps.facebook.com/MyFBApplication/Home/Index/
As mentioned above facebook request the page data behind the scenes from.
http://www.myapplicationserver.com/facebook/123456/Home/Index/
The problem is a call to
Html.ActionLink("Home", "Index", "Home")
will render a link that leads to
http://apps.facebook.com/facebook/123456/Home/Index/
and I need it to lead to:
http://apps.facebook.com/MyFBApplication/Home/Index/
I did get it work properly buy building a new set of extension methods.
Html.FacebookActionLink("Home", "Index", "Home")
Html.FacebookBeginForm("Index", "Home")
Html.Facebook(etc)
But this has a "smell" to it. I would like to find a place where I can intercept the plumbing of Html.ActionLink() in process and change the output. Then I can use all the standard calls.
Thanks!