IIS / ASP.NET: One URL returning 403 on one server despite other URLs in site working fine

StackOverflow https://stackoverflow.com/questions/22925021

  •  29-06-2023
  •  | 
  •  

Domanda

I have taken over the maintenance of a production website at a new job that is written in ASP.NET 4 Webforms and that runs on IIS 6 on Windows Server 2003. I am not familiar with Webforms nor managing IIS...so I am kind of working things out as I go here.

I have done several deployments to our production server which have worked fine, but am now setting up a test environment that is identical, just a different IP address/domain, so we can properly test changes first.

I have a problem where on this test site any URL that does NOT end with a reference to a file (always .aspx on this site) will return a 403 error on this server. For example http://users.test.oursite.com/admin will always return a 403 error when logged into the site. It should be redirecting to http://users.test.oursite.com/admin/organisation.aspx. Having an MVC background I am not even sure how this happens...but it does in production.

Browsing links within the site is fine as they always reference an .aspx file. Manually typing URLS that reference an .aspx file is fine, just not when the URL does not contain a file. This is not a problem on the production server.

As I said, I am not familiar with WebForms or managing IIS itself...so I have kind of run out of places to look.

Is there anything that comes to mind that I should be looking at that could be causing this problem?

È stato utile?

Soluzione

In WebForms typically there is no routing involved.

  1. You need to either provide a full path on the URL ending with .aspx OR
  2. setup default documents for your website. (Index.aspx, Default.aspx etc.)

http://www.iis.net/configreference/system.webserver/defaultdocument

OR

<configuration>
   <system.webServer>
      <defaultDocument enabled="true">
         <files>
            <add value="home.html" />
         </files>
      </defaultDocument>
   </system.webServer>
</configuration>

Default documents can be setup in IIS Properties or via web.config. Otherwise you need to provide the full path.

And because you haven't setup the DirectoryBrowsing (in IIS), you get a 403 Error when you try to access the Directory.

Enable the Directory Browsing option in IIS (not recommended) if you want this error to go away.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top