1

I'm developing my MVC 5 app using VS 2013, it was working fine, but suddenly it's giving the following error.

HTTP Error 403.14 - Forbidden

The Web server is configured to not list the contents of this directory.

I've already read this post, and it didn't solve the problem.

I've tried the followings:

  1. %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir
  2. setting runAllManagedModulesForAllRequests in system.webServer to true.
  3. setting owin:AutomaticAppStartup to false.
  4. Restarting VS and Windows!
  5. Publishing the app and trying to run it on IIS (I'm using Win 8.1).
  6. I'm sure no one played with permissions.
  7. I've turned on .NET Extensibility 3.5.
  8. I've copied the project on a local disk and tried to run it there.

I was developing a custom User Store and that's why I've tried to disable owin configuration (but I didn't change anything in global.asax or web.config during the development.)

When I run the app, for a second and before that error, I can see the correct title. And I can run other apps just fine.

I've put a break point and the following exception was the first item in the IntelliTrace. Can it have anything to do with the error?

Exception:Caught: "Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\~AspAccessCheck_75bc30d35780.tmp' is denied." (System.UnauthorizedAccessException) A System.UnauthorizedAccessException was caught: "Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\~AspAccessCheck_75bc30d35780.tmp' is denied."

Community
  • 1
  • 1
Akbari
  • 2,369
  • 7
  • 45
  • 85
  • Check that your app pool is set to Framework 4.5, either that or it could be your routing is wrong... just a few ideas – Luke Jun 15 '15 at 09:04
  • In the IIS Manager, the `DefaultAppPool` is set to `v4.0.30319`. Application Pools has a row for `4.5`, but in the `CLR version`, there is just 4 and 2. – Akbari Jun 15 '15 at 09:12
  • ok well it sounds like you're ok on that front. I have also seen this when my routing wasn't right. Are you able to navigate to any other pages on your site other than the one that you are receiving the error on? – Luke Jun 15 '15 at 09:13
  • No, I've tried several pages, but all of them give that error. – Akbari Jun 15 '15 at 09:14
  • ok, so it could be something detrimental in your routing? – Luke Jun 15 '15 at 09:15
  • I didn't change the route config, and it's very simple. Would you like me to update the question? – Akbari Jun 15 '15 at 09:16
  • Thanks for you time Coulton, I was changing the custom user store to implement `IUserPasswordStore`. – Akbari Jun 15 '15 at 09:22
  • ooo.. have you configured the login redirect path? I wonder if you're redirecting back to a forbidden page cause you're not logged in – Luke Jun 15 '15 at 09:23
  • Yes, I've set the `LoginPath` in the configuration. And I have used the `Authorize` attribute in just one controller. Please see the updated question. – Akbari Jun 15 '15 at 09:28
  • Have you had any joy? – Luke Jun 15 '15 at 12:31
  • I still have the problem! – Akbari Jun 16 '15 at 02:41

1 Answers1

1

Stilly! There is a refactor bug in VS that changes the routes as well!

My default route was changed to the following and I had to rename name to id and everything is working fine!

routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{name}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
Community
  • 1
  • 1
Akbari
  • 2,369
  • 7
  • 45
  • 85
  • 1
    I had a suspicion it would be the routing. Glad to hear that you got to the bottom of it! – Luke Jun 16 '15 at 07:54
  • Thanks Coulton. :) You suggested it yesterday, and I even looked at the config, but I didn't notice the change. – Akbari Jun 16 '15 at 07:56