Senior & Expert .Net Developers Discussion Forum by Nyros Technologies

HIRE .Net Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

How to set routes in global.asax file in ASP.Net MVC

 
Post new topic   Reply to topic    Senior & Expert .Net Developers Discussion Forum by Nyros Technologies Index -> Asp.Net
View previous topic :: View next topic  
Author Message
pavani



Joined: 26 Mar 2010
Posts: 37

PostPosted: Fri Jul 02, 2010 11:20 am    Post subject: How to set routes in global.asax file in ASP.Net MVC Reply with quote

Hi.,

I am new to ASP.net MVC..,


Can any one tell me how to set Route in Global.asax file.


Thanks in Adavance
_________________
Pavani....Smile
Back to top
View user's profile Send private message
jessie



Joined: 22 Apr 2010
Posts: 23

PostPosted: Fri Jul 02, 2010 11:37 am    Post subject: Reply with quote

Hi.,

By default Global .asax file contains

public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

}

protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();

RegisterRoutes(RouteTable.Routes);
}
}
}


Or it can be empty

If it is empty please copy and paste the above code to your page.

you can handle your own routes like below

routes.MapRoute(
"Answers",
"Answers/{id}/",
new { controller = "Home", action = "Answers", id = "" }
);

its better to follow page navigation concept explained by rajesh (http://www.dotnetexpertsforum.com/implement-page-navigation-in-mvc-like-gridview-control-t1649.html) then you will understand mere
_________________
Jessica.,Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert .Net Developers Discussion Forum by Nyros Technologies Index -> Asp.Net
Page 1 of 1


 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts How to Add Update Delete for gridview using Webservice
1 sanjay 31 Fri Sep 10, 2010 7:05 am
setty View latest post
No new posts Is there any free webhosts that support ASP.NET. ?
2 Balaji 634 Tue Sep 07, 2010 10:24 am
chrisadam View latest post
No new posts Hostings For ASP.NET 2.0 with SQL Server
2 Avash 676 Tue Sep 07, 2010 10:21 am
chrisadam View latest post
No new posts Exceptional Manger
1 suraj 51 Thu Sep 02, 2010 8:52 am
Rahul View latest post
No new posts background image for UITableView
0 kumar 55 Wed Sep 01, 2010 10:34 am
kumar View latest post
No new posts Types of Run time exceptions
1 Dheeraj 52 Wed Sep 01, 2010 8:58 am
venkat View latest post
No new posts Access Web Page content in Windows Forms without WebBrowser
3 mouli 273 Wed Sep 01, 2010 7:31 am
rajesh View latest post
No new posts Explain Interlocked Class & Daemon Thread's?
1 mukundh 76 Wed Sep 01, 2010 7:19 am
setty View latest post
No new posts Life Cycle Of Delegate
0 vinay 40 Wed Sep 01, 2010 7:14 am
vinay View latest post
No new posts Accessing methods defined in another page
1 suraj 37 Tue Aug 31, 2010 12:45 pm
Rahul View latest post




Hire an expert .Net developer / coder / programmer or development team from India now!!

Other Forums : Ruby on Rails   ::   PHP   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About .Net Experts   |   More