为什么存在视图和操作方法时出现HTML 404错误?

时间:2019-04-22 07:53:30

标签: c# model-view-controller view http-status-code-404 action

在我的项目中,我在SistemGaleri控制器中添加了操作方法,然后放置了相关视图。 动作方法名称:GaleriIslemleri 视图名称:位于View / SistemGaleri文件夹中的GaleriIslemleri.cshtml

    public ActionResult GaleriIslemleri()
    {
        var sistemGaleriDosyaAramaKriter = new SistemGaleriDosyaAramaKriter();
        try
        {

        }
        catch (Exception ex)
        {
            //HelperUtils.CmsLogger.Error(ex, "Duyuru/Liste");
        }


        return View();
    }

1 个答案:

答案 0 :(得分:0)

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

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

        routes.MapRoute(
            name: "Dosya",
            url: "{controller}/{action}/{Id}/{query}",
            defaults: new { controller = "Home", action = "Index", query = UrlParameter.Optional },
            constraints: new { Id = "\\d+" }
        );
        routes.MapRoute(
     name: "Dosya Duzenle History",
     url: "{controller}/{action}/{query}/{ishistory}/{Id}",
     defaults: new { controller = "Dosya", action = "DosyaDuzenle", ishistory = UrlParameter.Optional, query = UrlParameter.Optional },
       constraints: new { Id = "\\d+" }
 );

        routes.MapRoute(
            name: "Dosya Versiyon Ekle",
            url: "{controller}/{action}/{Id}/{query}/{ParentRaporId}",
            defaults: new { controller = "Dosya", action = "DosyaVersiyonEkle", query = UrlParameter.Optional },
            constraints: new { Id = "\\d+", ParentRaporId = "\\d+" }
        );


        routes.MapRoute(
           name: "History",
           url: "{controller}/{action}/{ishistory}/{query}",
           defaults: new { controller = "AnaSayfa", action = "Index", ishistory = UrlParameter.Optional, query = UrlParameter.Optional }
       );

        routes.MapRoute(
           name: "raporPaylasim",
           url: "{controller}/{action}/{kod}/{tarih}/{optional}",
           defaults: new
           {
               controller = "Rapor",
               action = "RaporPaylasim"
               ,
               kod = UrlParameter.Optional
               ,
               tarih = UrlParameter.Optional
               ,
               optional = UrlParameter.Optional
           }
           ///, constraints: new { kategoriKod = "[a-zA-Z0-9._-]+" }
       );
    }
}

@ vasily.lib,您可以检出我的配置文件