The Web server is configured to not list the contents of this directory. asp.net vs 2012 error?

前端 未结 7 1537
無奈伤痛
無奈伤痛 2021-02-02 08:40

Got following Error:

HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

this is how I linke

相关标签:
7条回答
  • 2021-02-02 08:54

    When you press Ctrl+F5, then IIS don't understand what to serve as you don't have any Default aspx file in your site , i recommend you to add a aspx file by going to Add>NewItem>Webform> Note: remember to check the box at bottom right , "select from master page" after selecting , save all the pages and just open your default.aspx file and you will surely see the reflected design as you did in master page.

    Master pages are not aspx file but serve as a template for other webpages , so you cant just open master page.

    0 讨论(0)
  • 2021-02-02 08:56

    The Ramesh Rajendran's answer must working, but you can use look at what is the modules your web application use and add in system.webServer tag on webconfig file to they use it. I had this error also in a test web application when I put it on Server IIS.

    It's very strange not list the contents with the option enabled on IIS Web Server.

    0 讨论(0)
  • 2021-02-02 08:57

    You should define a default document value in web config and disable directory browsing.

    <system.webServer>
    <defaultDocument>
       <files>
          <add value="insertion.aspx" />
       </files>
    </defaultDocument>
    <directoryBrowse enabled="false" />
    

    0 讨论(0)
  • 2021-02-02 09:03

    A Short Story Of A Lost Controller, And A Happy Ending

    Let's say you have a controller called Data, in the project file /Controllers/DataController.cs. You can access it just fine via http://yoursite.com/data, which is handled by the DataController.Index action method.

    Then, somehow, it breaks, and you start getting "The Web server is configured to not list the contents of this directory" when you visit this URL. Strangely, visiting /data/index still works! You try all the suggestions found online to make this work but can't seem to do it. What could it be?

    Perhaps you ought to think about what the error means. It says that when you visit /data, it finds a directory there, but you aren't allowed to see the files in it. Setting aside the fact that your routing doesn't seem to work and it should, could there actually be a directory there?

    Yes, there could! In your web project, you cleverly added folder /Data! This is a physical folder that takes precedence in the server's static routing rules (since you didn't rewrite those so physical files would be looked at after managed virtual paths).

    The solution is thus to rename the folder, or rename the controller, one or the other. This will fix your problem quite speedily and you may then proceed on your merry way coding long into the night to the enveloping strains of techno Spanish mandolin trance music, with your trusty cat snoozing on your foot and the cold beverage of your choice beading up on the desk next to you!

    0 讨论(0)
  • 2021-02-02 09:04

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

    The keyword in the error is list.

    That sounds more like you do not have a default document set up. If you don't have one, nor don't request a specific document (e.g. http://www.foobar.com/ or http://www.foobar.com/foo.html respectively) IIS will not "know" what to "serve" to the browser nor will it, nor should you expect it to, list the contents of that directory (instead).

    See: Microsoft Support: Error 403.14

    0 讨论(0)
  • 2021-02-02 09:16

    Have you tried setting the following within your web.config file :

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
    </system.webServer>
    
    0 讨论(0)
提交回复
热议问题