Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

ASP.NET MVC
adamking
#1 Posted : Wednesday, March 17, 2010 5:45:47 AM(UTC)
Groups: Member
Joined: 2/21/2010(UTC)
Posts: 7
Location: UK

Can Cassini be used to host ASP.Net MVC projects?

Regards
MikeK
#2 Posted : Wednesday, March 17, 2010 10:44:52 AM(UTC)
Groups: Member
Joined: 3/17/2010(UTC)
Posts: 2
Location: Denver, CO

Agreed, and which versions (MVC 1 vs. MVC 2)?
adamking
#3 Posted : Thursday, March 18, 2010 12:22:53 AM(UTC)
Groups: Member
Joined: 2/21/2010(UTC)
Posts: 7
Location: UK

MikeK,

I have been experimenting, Cassini uses the same flow as IE6, so it is needed to alter the default routing in order to get this working.
You need to change the first segment of any address to contain the .mvc extension. Otherwise, Cassini doesn't invoke the ASP.NET extension, and gives a 403 forbidden as it tries to open the relevant folder.


routes.MapRoute(
"Normal", // Route name
"{controller}.mvc/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

routes.MapRoute(
"Root",
"",
new { controller = "Home", action = "Index", id = "" }
);

The second route will force an action if no page is specified. This does not happen automatically on IIS6 or Cassini and this must be added.

Kind of answered my own thread here, but hopefully this will be of use to you Mike.

Adam
Ultidev Team
#4 Posted : Thursday, March 18, 2010 5:30:15 AM(UTC)
Ultidev Team

Groups: Administration
Joined: 11/3/2005(UTC)
Posts: 2,253

Thanks: 28 times
Was thanked: 60 time(s) in 59 post(s)
Adam,

Thank you much for contributing!

Best regards,
UltiDev Team.
Please donate at http://www.ultidev.com/products/Donate.aspx to help us improve our products.
Rss Feed  Atom Feed
Users browsing this topic
Guest (8)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.