简体   繁体   中英

Default Document and HttpHandler serve a specific page

I am in the following situation.

I have IIS 7.5 with an ASP.NET application. The application must run with IIS Classic Mode.

I have one HttpHandler that serves all the Request:

  <httpHandlers>
  <add verb="*" path="*.aspx" type=".....HandlerFactory..." />
</httpHandlers>

The problem is that i can't establish a Default Document to an non phyisical file. I want that the Default Page be : Home.aspx (which is a non phyisical file).

So when I go: www.mysite.com I get an error:

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

I do not want to make a REDIRECT.

Is there any way to accomplish this without having to create a index.html to redirect to Home.aspx?

Thanks in advance!

One option would be to rewrite requests to / to /home.aspx.

The old IIS5/6 trick here is to put a blank default document in the folder -- this will get past the "does the file exist" but your http handler will kick in and take over so said blank document won't be involved.

I'll note this is why ASP.NET MVC ships with a Default.aspx in the root.

如果您创建一个空白的Home.aspx文件并将其设置为默认页,则IIS将把它作为您的默认文档,但是它仍将由处理程序处理。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM