ASP.net MVC support for URL’s with hyphens

C# version of John’s Post for anyone who would prefer it: C# and VB version on my blog public class HyphenatedRouteHandler : MvcRouteHandler{ protected override IHttpHandler GetHttpHandler(RequestContext requestContext) { requestContext.RouteData.Values[“controller”] = requestContext.RouteData.Values[“controller”].ToString().Replace(“-“, “_”); requestContext.RouteData.Values[“action”] = requestContext.RouteData.Values[“action”].ToString().Replace(“-“, “_”); return base.GetHttpHandler(requestContext); } } …and the new route: routes.Add( new Route(“{controller}/{action}/{id}”, new RouteValueDictionary( new { controller = “Default”, … Read more

Angular2 router: how to correctly load children modules with their own routing rules

You can try this using loadChildren where the homeModule, productModule, aboutModule have their own route rules. const routes: Routes = [ { path: ‘home’, loadChildren: ‘app/areas/home/home.module#homeModule’ }, { path: ‘product’, loadChildren: ‘app/areas/product/product.module#ProductModule’ }, { path: ‘drawing’, loadChildren: ‘app/areas/about/about.module#AboutModule’ } ]; export const appRouting = RouterModule.forRoot(routes); and the home route rules will be like export const … Read more

ASP.NET URL Rewriting

Try the Managed Fusion Url Rewriter and Reverse Proxy: http://urlrewriter.codeplex.com The rule for rewriting this would be: # clean up old rules and forward to new URL RewriteRule ^/?user=(.*) /users/$1 [NC,R=301] # rewrite the rule internally RewriteRule ^/users/(.*) /?user=$1 [NC,L]

What’s the difference between application- and router level- middleware when routing in Express?

What is the purpose of app.use passing it to router.get instead of simply using app.get? This is all just designing for modularity. It allows an application to be divided into several smaller loosely-coupled pieces and because they all do not have any direct knowledge of the shared app instance that combines them together, the modularity … Read more

ASP.NET MVC Url Route supporting (dot)

Add a UrlRoutingHandler to the web.config. This requires your url to be a bit more specific however (f.e. /Users/john.lee). This forces every url starting with /Users to be treated as a MVC url: <system.webServer> <handlers> <add name=”UrlRoutingHandler” type=”System.Web.Routing.UrlRoutingHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” path=”/Users/*” verb=”GET”/> </handlers> </system.webServer>

Flask and React routing

We used catch-all URLs for this. from flask import Flask app = Flask(__name__) @app.route(“https://stackoverflow.com/”, defaults={‘path’: ”}) @app.route(‘/<path:path>’) def catch_all(path): return ‘You want path: %s’ % path if __name__ == ‘__main__’: app.run() You can also go an extra mile and reuse the Flask routing system to match path to the same routes as client so you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)