ASp.Net MVC routing
- by suneehs
Hi,
I am using MVC 2.0 to create my application,my problem i s related to the routing.
Actually in my application each user have required seperate subdomain,like www.example.com/user1/ ,www.example.com/user2/ ...etc.the default domain is www.example.com.So how can i make it possible with routing in mvc.
i have tried like this,
routes.Add(new Route(
"{id}",
new RouteValueDictionary(
new { controller = "User", action = "login", id = " " }
), new MvcRouteHandler()));
var defaults = new RouteValueDictionary(
new
{
controller = "Home",
action = "Index",
id = UrlParameter.Optional
}
);
routes.Add(new Route(
"{controller}/{action}/{id}",
defaults,
new MvcRouteHandler()));
But the problem is that it take deafult (www.example.com) directly to user login page.I want the default page as Home/index and when www.example.com/user1/ it will go to user login page.Is there any way ..pls help me