HTTP Error 403.14 - Forbidden

Discussion in 'ASP.NET / ASP.NET Core' started by Marcus Perez, Mar 29, 2014.

  1. Hi, I'm at wits end here trying to figure this out.
    I'm consistently getting: HTTP Error 403.14 - Forbidden

    My application works great locally but when I deploy to the hosted site, kaboom. :(

    Here's what's in play:
    • IIS 8 (hosted)
    • VS 2013
    • ASP.NET MVC 5
    Here's the hierarchy in IIS:
    1. Root
      1. admin
        1. dev
        2. prod
      2. mobile
        1. dev
        2. prod
    I've turned off directory browsing from the root and all children inherit that setting.

    In the root I have a default.asp file that contains the logic to redirect requests to a sub-domain to a specific folder.

    Code:
    <%
    
    'The only purpose of this page is to redirect traffic to a sub-folder which how Discount ASP.NET handles sub-domains.
    
    Dim serverName
    
    serverName = UCase(Request.ServerVariables("SERVER_NAME"))
    
    'Response.Write(serverName)
    'Response.End()
    
    If serverName = "VINBILLING.COM" Then
        Response.Redirect("/admin/prod")
    End If
    
    If serverName = "WWW.VINBILLING.COM" Then
        Response.Redirect("/admin/prod")
    End If
    
    If serverName = "DEV.VINBILLING.COM" Then
        Response.Redirect("/admin/dev")
    End If
    
    If serverName = "PROD.VINBILLING.COM" Then
        Response.Redirect("/admin/prod")
    End If
    
    If serverName = "MOBILE.DEV.VINBILLING.COM" Then
        Response.Redirect("/mobile/dev")
    End If
    
    If serverName = "MOBILE.PROD.VINBILLING.COM" Then
        Response.Redirect("/mobile/prod")
    End If
    %>
    I've updated my routing to handle the folders and it still doesn't work and I have no idea how to get this working.

    Here is what Route.Config looks like:
    Code:
        public class RouteConfig
        {
            public static void RegisterRoutes(RouteCollection routes)
            {
                routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
                routes.MapRoute(
                    name: "DefaultSubDomain",
                    url: "mobile/dev/{controller}/{action}/{id}",
                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                    );
    
                routes.MapRoute(
                    name: "Default",
                    url: "{controller}/{action}/{id}",
                    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                    );
    
    
            }
        }
    Someone please help!

    Thanks in advance!
     
  2. Can you provide us with a URL so we can look at the Forbidden message in detail?
     
  3. Ok so I figured this out and everything is working now.

    Something important I left out was that I started out with MVC 4 and upgraded to 5. In the process, there are undesirable things left behind in the config file that will cause some problems. I don't know exactly what was causing the issue but I wanted to at least share what I did to get past this.

    I created a new MVC 5 app and compared the web.config files. I stripped down the config file to make it look as simple as the newly created web.config as possible.

    I ended up removing the following from my config and everything started working:

    Code:
    <pages controlRenderingCompatibilityVersion="4.0">
          <namespaces>
            <add namespace="System.Web.Helpers" />
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Optimization" />
            <add namespace="System.Web.Routing" />
            <add namespace="System.Web.WebPages" />
          </namespaces>
        </pages>
    
    <modules runAllManagedModulesForAllRequests="true">
          <remove name="UrlRoutingModule-4.0"/>
          <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" preCondition="" />
        </modules>
    
    <handlers>
          <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
          <remove name="OPTIONSVerbHandler" />
          <remove name="TRACEVerbHandler" />
          <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
          <add name="UrlRoutingHandler" type="System.Web.Routing.UrlRoutingHandler,                       System.Web, Version=4.0.0.0,                       Culture=neutral,                       PublicKeyToken=b03f5f7f11d50a3a" path="/bundles/*" verb="GET" />
        </handlers>
    
    
    I hope this helps someone.
     
    martino and andcon like this.
  4. hey guys, I just deployed to the server via TeamCity and the error is back! oh man this is so frustrating :mad:

    here is the URL: http://mobile.dev.vinbilling.com
     
  5. Thanks for the URL, i'm seeing the error message noted in my attached image at the URL you provided, are you seeing a different error?

    From my experience the error message in my screen shot can be resolved by opening up your project locally, removing your assembly references, restarting your development client, adding your assembly references back in, re-building your solution, and then finally re-deploying.
     

    Attached Files:

    martino, Marcus Perez and mjp like this.
  6. FrankC

    FrankC DiscountASP.NET Staff

    The error indicates a missing DLL usually.
     
  7. I apologize. I was messing around with the site by the time you guys got to it in an effort to try to get it working.
    Frank, you are right, it was a missing DLL issue.

    The root cause of the issue was within my build process. When I deploy from Visual Studio it works fine.
    I have everything working great now.

    Thanks everyone for your time!
     
    martino and andcon like this.
  8. Niiiice, glad you got it sorted out!
     

Share This Page