PDA

View Full Version : ASP.NET MVC Preview 2


ksachdeva
03-22-2008, 01:20 AM
Hi,

I am trying to run the most simplest of MVC application (basically the one generated by template) and running in to 404 issues.

I even added .mvc extension in front of controller name as recommended [please see the snippet below]

[quote]
publicstaticvoidRegisterRoutes(RouteCollectionrout es)
{
//Note:ChangetheURLto'{controller}.mvc/{action}/{id}'toenable
//automaticsupportonIIS6andIIS7classicmode

routes.Add(newRoute('{controller}.mvc/{action}/{id}',newMvcRouteHandler())
{
Defaults=newRouteValueDictionary(new{action='Index ',id=''}),
});

routes.Add(newRoute('Default.aspx',newMvcRouteHand ler())
{
Defaults=newRouteValueDictionary(new{controller='H ome',action='Index',id=''}),
});
}
</CODE>

and it does not help either.

Please guide

Regards
Kapil

bruce
03-22-2008, 04:14 AM
Are you on IIS 6 or IIS 7?


If you are on IIS6, please open a support ticket and request .mvc to be mapped to ASP.NET


If you are using IIS7, you can use the IIS Manager (MS download) to add the scriptmap yourself.



Please let us know if preview 2 will work on the server once the mapping is installed.

Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

mdselite
03-23-2008, 10:32 AM
Im on IIS 7, and I tried uploading the sample proj, worked fine for me (I didn't add .mvc)

bruce
03-24-2008, 08:13 AM
I think IIS 7 has that script map built in.


Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

viraree
06-10-2008, 09:13 AM
I'm havingproblems with Preview 3. Does anyone have a clue about how to get a MVC Hello World application to work?
I have no problems running the app on my local host, but that didn't happen on DiscountASP, and I did put all Preview assembly references in my own folder on the host machine.

infinitedreams13
06-27-2008, 05:29 AM
Thanks toLiam Westley for pointing me in the right direction. http://community.discountasp.net/default.aspx?m=22822&amp;f=33&amp;p=1

Make sureyour global.asax.cs includes:

public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}.mvc.aspx/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}

andyour Default.aspx.cs has:

public void Page_Load(object sender, System.EventArgs e)
{
Response.Redirect("~/Home.mvc.aspx");
}