how to use routes.Ignore in asp.net website

Posted by Jpchoudhari under ASP.NET on 9/17/2012 | Points: 10 | Views : 1949 | Status : [Member] | Replies : 0
Hi,

I am using routing in my asp.net website 4.0 I was able to do it successfully until i came to know all the css/js files are also routed the same way and i want to skip that. I goolged it but couldn't find it.

I am doing something like this
RouteTable.Routes.MapPageRoute("HomePage", "Home", "~/Home.aspx"); // JS working fine here

RouteTable.Routes.MapPageRoute("Servicepage", "Service/ServiceName", "~/ServiceName.aspx"); // JS not working here
as ServiceName.aspx lies on root of website. and all js/css/images files get url like
http://localhost:1111/projectname/service/css/csfilename.css

To ignore routes i tried below thing before defining any of the routes, on the top of Application_start event

System.Web.Routing.RouteTable.Routes.Ignore("{file}.js");
System.Web.Routing.RouteTable.Routes.Ignore("{file}.css");
System.Web.Routing.RouteTable.Routes.Ignore("{file}.png");
routes.Ignore("{resource}.axd/{*pathInfo}");

kindly help me doing this

Kind Regards,
Jay



Responses

(No response found.)

Login to post response