-2

This is my actionlink

@Html.ActionLink("Details", "Details", new { id = item.WarehouseID })

It gives me this link http://localhost:6587/WareHouse/Details/1.00000000

The Controller

public ActionResult Details(decimal? id)
{
    Warehouse Warehouse = db.Warehouse.Find(id);
    return View(Warehouse);
}

when I change the action link to

@Html.ActionLink("Details", "Details", new { WareHouseID = item.WarehouseID })

And retrieve the link as queryString it works well

public ActionResult Details(decimal? WareHouseID) 
{
    Warehouse Warehouse = db.Warehouse.Find(WareHouseID);
    return View(Warehouse);
}

But as id it gives me

HTTP Error 404.0 - Not Found

I tried to trace it by debugging but it not step into details actionResult with that link http://localhost:6587/WareHouse/Details/1.00000000

my route config

using System.Web.Routing;

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

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
  • You not seriously using a `decimal` as an identifier/key are you? –  Mar 23 '16 at 06:30
  • yes I am using decimal ,, no problem with duplicates of dots but it is because of dots . The link that you putt is really helpful ,, I found that if I put trailling slash it works well , that is because without the trailing slash, IIS thinks it is a file that it should go and find. Adding the slash has the effect of...this is not a real file... so I am trying now to do some thing about that , thanks for help – Ibrahim Fathy Mar 24 '16 at 15:24

1 Answers1

0

It is because of dots . I found that if I put trailling slash it works well , that is because without the trailing slash, IIS thinks it is a file that it should go and find. Adding the slash has the effect of...this is not a real file... so I am trying now to do some thing about that .

The details Dots in URL causes 404 with ASP.NET mvc and IIS

Community
  • 1
  • 1