0

I spend 3 hours and didnt get success. I cant figure out the right solution.

This is what I am trying and getting null. My homepage is working but the others is not working.

Url.Action("ShowDilKursuMenu","DilKursu") => getting null

I am trying getting like this from this code url action https://localhost:44313/dil-kurslari for my parent html menu. Html child menu have like https://localhost:44313/dil-kurslari/germany or https://localhost:44313/dil-kurslari/germany/frankfurt

 #region DilKursu
        routes.MapRoute(
            name: "DilKursuUlkeEyaletSehir",
            url: "dil-kurslari/{ulke}/{eyalet}/{sehir}/{ilce}/{firma}",
            defaults: new
            {
                controller = "DilKursu",
                action = "ShowDilKursuMenu",
                ulke = UrlParameter.Optional,
                eyalet = UrlParameter.Optional,
                sehir = UrlParameter.Optional,
                ilce = UrlParameter.Optional,
                firma = UrlParameter.Optional,
            });

        routes.MapRoute(
            name: "DilKursuAll",
            url: "dil-kursu/{ulke}/{eyalet}/{sehir}/{ilce}/{firma}/{kursAdi}",
            defaults: new
            {
                controller = "DilKursu",
                action = "DilKursuDetay",
                ulke = UrlParameter.Optional,
                eyalet = UrlParameter.Optional,
                sehir = UrlParameter.Optional,
                ilce = UrlParameter.Optional,
                firma = UrlParameter.Optional,
                kursAdi = UrlParameter.Optional,
            });

        #endregion
        #region HomeIndex2
        routes.MapRoute(
            name: "HomeLang2",
            url: "",
            defaults: new { controller = "Home", action = "HomeIndex" }
        );
        #endregion

One important thing is DilKursuAll named route required all of this parameters.

Alican Kablan
  • 399
  • 8
  • 17

1 Answers1

0

Can you try this in your browser and see https://localhost:44313/DilKursu/DilKursuDetay/ Rest i can see all the parameters are optional parameters