Sunday, May 6, 2012

Asp.Net Routing is not working



add the below code snipped to the web.config
   < system.webServer>
     < modules runAllManagedModulesForAllRequests="true"/>
   < /system.webServer>


AND also


in the global.asax fıle, find the Application_Start(object sender, EventArgs e) event, add the code to the event.



        protected void Application_Start(object sender, EventArgs e)


        {

            routes.Ignore("{resource}.axd/{*pathInfo}");
            routes.Ignore("{*alljs}", new { alljs = @".*\.js(/.*)?" });
            routes.Ignore("{*allcss}", new { allcss = @".*\.css(/.*)?" });
            routes.Ignore("{*allpng}", new { allpng = @".*\.png(/.*)?" });
            routes.Ignore("{*allgif}", new { allgif = @".*\.gif(/.*)?" });
            routes.Ignore("{*alljpg}", new { alljpg = @".*\.jpg(/.*)?" });
            routes.Ignore("{*allbmp}", new { allbmp = @".*\.bmp(/.*)?" });

            RegisterRoutes(RouteTable.Routes);
            RouteTable.Routes.Add("about-browse", new Route("aboutus", new PageRouteHandler("~/About.aspx")));

        }

No comments:

Post a Comment