rblerk
rblerk

Reputation: 17

How to ignore URL routing for subdirectories ASP.NET 4.0

i am routing company names to the their pages with URL routing .NET 4.0

www.xyz.com/companyname it works good, but i dont want to route if the page like this

www.xyz.com/Pages/Company/Products.aspx?id=123 i want to ignore if url start with "Pages"

    void RegisterRoutes(RouteCollection routes)
    {
        routes.Ignore("~/Pages/"); // i tried this but did not work

        routes.Ignore("{resource}.axd/{*pathInfo}");
        routes.Ignore("");
        routes.MapPageRoute(
           "Bayi Sayfa",               
           "{*BayiName}",  
           "~/Pages/HomePage/Default.aspx" 
        );
    }

also i tried this

routes.Ignore("Pages/");

but this is also not working

Upvotes: 0

Views: 1197

Answers (1)

rblerk
rblerk

Reputation: 17

I found the problem when i ignored other file extensions

   routes.Ignore("{*alljs}", new { alljs = @".*\.js(/.*)?" });
   routes.Ignore("{*allcss}", new { allcss = @".*\.css(/.*)?" });

then this line is working

   routes.Add(new Route("Pages", new StopRoutingHandler()));

Upvotes: 2

Related Questions