Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two database tables I'm testing in MVC5, Clients and Properties. I am thinking there might be a problem with my Properties database table. I created a brand new MVC5 application, using Entity Framework 6, and I'm just going with the auto-generated model, controllers, and views.

With the Clients table, I have no problem. I can go to Details and back to list and I can create a new Client and it works fine. But with Properties, if I'm displaying the Index page and if I go to Details or Edit and try to return to the list, or if I try to create a new Property, I get a "HTTP Error 403.14 - Forbidden" error. Edits are successfully saved, but after saving an edit or if returning from the Edit or Details screen, it fails to return to Index.

It says the most likely cause is "A default document is not configured for the requested URL, and directory browsing is not enabled on the server.", even though everything is auto-generated. I Clients works but Properties does not, could the problem be in the database? I'm using SQL Server 2016 Express. It also tells me to make directory browsing changes in IIS using appcmd, but the system doesn't find appcmd and I'm not using IIS. I'm just trying to test it in the Express for Web 2015 environment.

What I have tried:

I have tried deleting and recreating the controllers and views. I then tried also replacing the model. I then tried creating a completely new application. I continue having this problem with the Properties table. Actually, I have additional tables as well, and the problem is only happening with the Properties table.
Posted
Updated 5-Aug-17 8:43am
v6
Comments
Kornfeld Eliyahu Peter 6-Aug-17 8:13am    
As it is a 403 - you probably return a folder instead of page, however without your code (with the error) we can not tell...
Member 12824529 6-Aug-17 9:34am    
Thanks Peter. Actually, I resolved it last night. I added a route to the RouteConfig file, before the default one. Not sure why I needed a special route for returning from Edit or Details for an view set that was auto-generated. That's not usually the case.

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900