0

i am new to MVC and working on view having list of users and by selection on userid details should display on the screen... getting Error on selection of id like 'abc.xyx' .. is doing some wrong...

Error while select id field contains '.' Dot in it Example : xyz.abc

View

links

 <td>
        @Html.ActionLink("Edit", "Edit", new { id=item.vUserID  }) |
        @Html.ActionLink("Details", "Details", new { id=item.vUserID }) |
        @Html.ActionLink("Delete", "Delete", new { id=item.vUserID  })
    </td>

Controller

    // Error :  /User/Details/xyz.abc
    // no Error: /User/Details/5

    public ActionResult Details(string id)
    {
        try
        {

            tblUserMaster tblusermaster = db.tblUserMasters.Find(id);
            if (tblusermaster == null)
            {
                return HttpNotFound();
            }
            return View(tblusermaster);
        }
        catch (Exception)
        {

            throw;
        }
    }

Error on : localhost:9467/User/Details/dave.schneider Error message is

HTTP Error 404.0 - Not Found The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

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 = "User", action = "Index", id = UrlParameter.Optional }
        );
    }
}

what is wrong ?

Ajay K
  • 61
  • 1
  • 1
  • 10

2 Answers2

1

yes solve it by Change In Web.config File section and add

<system.webServer> <modules runAllManagedModulesForAllRequests="true" /> <validation validateIntegratedModeConfiguration="false" /> </system.webServer>

Ajay K
  • 61
  • 1
  • 1
  • 10
0

In the system.web section of your web.config(.net 4)

<httpRuntime relaxedUrlToFileSystemMapping="true" />
Arash
  • 889
  • 7
  • 18