Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have that basic mvc 3 application with razor view engine in 2010 visual studio. there are 2 menues "Home" and "About" . when i click on about the url on the site shows like home/about i dont want the About as a child of home. when i click on the "about" menue i want the url to look just the /About
somethinl like that. how can i do that. can i get a solution please. where do i do the work to fix it.

Updated:
I'm working on the new mvc 3 razor view. I'm in the beginning of the project. when i run the application the url at the address bar goes like http://localhost:1032/. when i click on the about menue, the url goes like http://localhost:1032/Home/About
where I dont want the About as a child of Home ( Home/About). i want the url to look like http://localhost:1032/About when i click the about menue. How can i do it. can i get the steps please.
Posted
Updated 28-Dec-11 6:16am
v2

1 solution

hi,

You route should look like this
C#
routes.MapRoute(
        "Home", // Route name
        "Home", // URL pattern
        new { controller = "Home", action = "Index"} // Parameter defaults
    );
}

routes.MapRoute(
        "About", // Route name
        "About", // URL pattern
        new { controller = "About", action = "Index"} // Parameter defaults
    );
}
 
Share this answer
 
Comments
rajh7 28-Dec-11 12:46pm    
There is already one routes.mapRoute with default routename. should I leaveit like that and add these two. Or i should replace that with one of these.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900