views:

224

answers:

1

Here is my issue. I have an ASPX web site and I have code in there to redirect from the login page with the call to "FormsAuthentication.RedirectFromLoginPage(username, false);" This sends the user from the root website folder to 'website/Admin/'. I have a 'default.aspx' page in 'website/Admin/' and the call to redirect works on a previous version of the website we have running currently, but the one that I am updating on a separate test server is not working. It gives me the error "Directory Listing Denied. This Virtual Directory does not allow contents to be listed." I have this in the config file:

<authorization>
  <allow users="*" />
</authorization>

under the "authentication" option and...

<location path="Admin">
  <system.web>
    <authorization>
      <deny users="?" />
    </authorization>
  </system.web>
</location>

for the location of Admin.

Also, there is no difference in the code between the web.config, Login.aspx, or the default.aspx files on the current server and the one on the test server, so I am confused as to why the redirect will not work on both. It even works in the Visual Studio server environment, for which the code is also identical.

Any suggestions and help is appreciated.

+1  A: 

Directory Listing Denied is an IIS error, stating that directory browsing on the server isn't allowed. If you see this, it means when browsing to Website/Admin, the server isn't finding any expected default documents and is then trying to show you the file directory through the browser (expected behavior). IIS is set to not allow this in your case (which is a good thing).

Can you contact the server admins and ask them to verify the default documents for the website, and add Default.aspx to the list? If not, at least find out what the default file names are in the site setup, and name your root page based on that.

I think by default IIS uses Default.htm and maybe one other. Even when registering asp.net with IIS, I don't believe Default.aspx is added. It has to be done manually.

KP
We needed a quick fix and apparently my boss said that they had has similar problems before, which I did not know about. We wound up throwing an 'index.html' page into that directory with the code for redirecting via html: <meta http-equiv="REFRESH" content="0; url=http://www.yourdomain.com/default.aspx"/>It now redirects to the default.aspx page perfectly. This should solve our problems if default pages get removed from the list in the future.
Mike Webb