ASP.NET MVC Routing vs. Reserved Filenames in Windows

前端 未结 4 910
谎友^
谎友^ 2020-12-04 22:03

In our ASP.NET MVC application, we\'ve noticed that we cannot have The Forbidden DOS File Names—COM1 through COM9, LPT1 through

相关标签:
4条回答
  • 2020-12-04 22:20

    For a similar reason, there can't be a web.config tag in StackOverflow.

    http://stackoverflow.uservoice.com/pages/1722-general/suggestions/98871-web-config-tag-404-error

    0 讨论(0)
  • 2020-12-04 22:20

    for another similar reason you can't have urls with a dot and a slash Semantic urls with dots in .net

    0 讨论(0)
  • 2020-12-04 22:30

    This has been addressed in ASP.NET 4. http://haacked.com/archive/2010/04/29/allowing-reserved-filenames-in-URLs.aspx

    You can apply a setting in web.config that relaxes this restriction.

    <configuration>
      <system.web>
        <httpRuntime relaxedUrlToFileSystemMapping="true"/>
    
        <!-- ... your other settings ... -->
      </system.web>
    </configuration>
    

    Hope that helps.

    0 讨论(0)
  • 2020-12-04 22:40

    Since asking the question, I've found that the bug is in ASP.NET proper, not IIS or ASP.NET MVC, meaning that there's no way to work around it. The only solution is to manually forbid URLs matching these names and these names followed by a period and random characters.

    0 讨论(0)
提交回复
热议问题