views:

103

answers:

1

Hi,

is it possible to generate cross-application action links using the HTML helper class?

I have the following (both are separate VS2008 projects):

http://mainwebsite/
http://mainwebsite/application

I would like to generate a link IN the /mainwebsite/application/ project TO /mainwebsite/. Is this possible? Or should I just hardcode a hyperlink?

addition:
My question also applies vice-versa. So generating a link IN /mainwebsite/ TO /mainwebsite/application/. I already managed to do like so, by simulating the application name as controller name:

<% =Html.ActionLink("ApplicationName","",new With {.Controller = "application" }) %>
+2  A: 

Yes, you can do this. The HTML helper generates URLs using the routing system, which is completely ignorant of ASP.NET MVC and your application. If you have a route in your route table for the other application, then you can generate a URL for it using the HTML helper. There is no rule which states that your route table can only contain routes for the current application, although you obviously need to be careful about how you order the routes.

Craig Stuntz
Nice, exactly the answer I was looking for :)
Ropstah