ASp.Net MVC routing

Posted by suneehs on Stack Overflow See other posts from Stack Overflow or by suneehs
Published on 2010-05-07T05:50:57Z Indexed on 2010/05/07 5:58 UTC
Read the original article Hit count: 207

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc-2