0
votes

I have a problem in MVC routing when i configure my site to www.domain.com/m

we are working in shopping cart website that will be available in asp.net and configured in www.domain.com and now we are developing mobile website using Asp.net MVC 4.

if we are creating separate sub domain like http://m.domain.com i need to purchase SSL for that domain. we decide to go mobile site using following URL www.domain.com/m for easy to navigate mobile devices with out redirecting another domain.

i have published my MVC 4 mobile site to /m folder. mobile site is working fine with www.domain.com/m and when i come to my html form post method looks like below. i am not able to access the /{controller}/{action}

<form ReturnUrl="" action="/m/Account/Login" data-ajax="false" method="post">

</form>

**my razor syntax**
@using (Html.BeginForm("Login", "Account", FormMethod.Post, new { data_ajax = "false", ReturnUrl = ViewBag.ReturnUrl }))
{
}
1
Meaning you get a 404? What does your routing look like?lc.
routes.MapRoute( name: "Default", url: "{controller}/{action}", defaults: new { controller = "Home", action = "Index" } );Rajesh GK
when i add /m before URL, /m site is not working routes.MapRoute( name: "Default", url: "m/{controller}/{action}", defaults: new { controller = "Home", action = "Index" } );Rajesh GK
Is that one route the only route? Do you have both together? What order are they registered in?lc.
when i am using {m}/{controller}/{action} or m/{controller}/{action} i received following error: 403 - Forbidden: Access is denied. You do not have permission to view this directory or page using the credentials that you supplied.Rajesh GK

1 Answers

0
votes

Use ~ before the action. action="~/m/Account/Login". See if this works!