How to prevent Url.RouteUrl(…) from inheriting route values from the current request

My solution was this : An HtmlExtension helper method : public static string RouteUrl(this UrlHelper urlHelper, string routeName, object routeValues, bool inheritRouteParams) { if (inheritRouteParams) { // call standard method return urlHelper.RouteUrl(routeName, routeValues); } else { // replace urlhelper with a new one that has no inherited route data urlHelper = new UrlHelper(new RequestContext(urlHelper.RequestContext.HttpContext, new … Read more

How do I set the default namespaces in MapHttpRoute?

We had this problem with the Umbraco core so we created our own IHttpControllerSelector, the source code can be found here: https://github.com/WebApiContrib/WebAPIContrib/blob/master/src/WebApiContrib/Selectors/NamespaceHttpControllerSelector.cs You can also install nuget package WebAPIContrib which contains NamespaceHttpControllerSelector. To register this you can do this on app startup: GlobalConfiguration.Configuration.Services.Replace(typeof(IHttpControllerSelector), new NamespaceHttpControllerSelector(GlobalConfiguration.Configuration)); The implementation is pretty straight forward and only deals with … Read more

How to use an Area in ASP.NET Core

In order to include an Area in an ASP.NET Core app, first we need to include a conventional route in the Startup.cs file (It’s best to place it before any non-area route): In Startup.cs/Configure method: app.UseMvc(routes => { routes.MapRoute(“areaRoute”, “{area:exists}/{controller=Admin}/{action=Index}/{id?}”); routes.MapRoute( name: “default”, template: “{controller=Home}/{action=Index}/{id?}”); }); Then make a folder named Areas in the app … Read more

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