Friday, 9 December 2016

url routing in VS 2010 for asp.net c#


Step 1: work only on VS2010 and above

 In order to implement URL Routing we will need to register the routes that we need to use in our application.
In order to do that I have created a method named RegisterRoutes and it has been called inside the Application_Start event inside the Global.asax file. This method will allow us to add routes to handle so that we can create our own custom URLs.

<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>

<script runat="server">
    void Application_Start(object sender, EventArgs e)
    {
        RegisterRoutes(System.Web.RouteTable.Routes);
    }
  
    static void RegisterRoutes(RouteCollection routes)
    {
        routes.MapPageRoute("Customers", "Customers", "~/Customers.aspx");
    }
</script>

for more info visit.

No comments:

Post a Comment