Hi Friends,
I am working on a Project build on ASP.NET 4.0, so currently if we access our web page "Customer.aspx" it shows like this in the address bar:
http://xxxx.com/Customer.aspx
But we need the requirement not to show the extension of the page to user, and we implemented the URL Routing and page started to look into the address bar:
http://xxxx.com/Customer
But, still if I hit the page like 'http://xxxx.com/Customer.aspx' it is working.
Please guide me where and what I am missing to redirect a user on 'http://xxxx.com/Customer' even if he hit on 'http://xxxx.com/Customer.aspx'
I have used the below code in Global.asax file
public void Application_Start()
{
RegisterRoutes(RouteTable.Routes)
}
private void RegisterRoutes(RouteCollection routes)
{
routes.Ignore("{*allaspx}", new { allaspx=@"*\.aspx" });
routes.MapPageRoute("CustomerRoute", "Customer", "~/Customer.aspx");
routes.EnableFriendlyUrls();
}
Thanks :)
What I have tried:
I used the System.Web.Routing to make the url routing.