Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpforms-lite domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the businext domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/ragipunal.com/wp-includes/functions.php on line 6114
ASP.NET MVC Routing .html uzantılı isteklerin yönlendirilmesi - RAGIP ÜNAL

Blog

ASP.NET MVC Routing .html uzantılı isteklerin yönlendirilmesi

Merhabalar, öncelikle .html uzantıları routinge uğramadan direk file sistemden aranıyordu. web.config dosyamızda system.webServer nodu içerisine aşağıdaki satırı ekleyin.

<add name="HtmlFileHandler" path="*.html" verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" >

Akabinde routinginiz aşağıdaki gibi bir şekil alsın. Gerisi size kalmış. İsterseniz gelen page yazısını db de aratıp istediğiniz bir control ve action a gönderebilirsiniz.

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.RouteExistingFiles = true;

    routes.MapRoute(
        name: "GenericHtml",
        url: "{page}.html",
        defaults: new { controller = "Common", action = "Generic", page = UrlParameter.Optional }
    );

    routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
}

Leave A Comment

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir