开发者

Setting Default URL in Web.Config for website (Routed page!)

开发者 https://www.devze.com 2022-12-09 15:27 出处:网络
This is a follow-up on this question. I basically have the same question as this question, but with a few differences. First of all, my url is http://site/Image/Cassandra/Image.aspx and I want to se

This is a follow-up on this question.

I basically have the same question as this question, but with a few differences. First of all, my url is http://site/Image/Cassandra/Image.aspx and I want to see http://site/Image/Cassandra instead. This is a routed page where I use ASP.NET routing to translate an url to the one above. But somehow, it doesn't find my page when I don't add "Image.aspx" or anything else ending with ".asmx".

That annoys me...

Since this has to run on both IIS 6 and 7, and because the administrators won't let me have access to the IIS configuration, I need to solve this from within my web application and I think web.config is the place to add the solution. But what is the solution?

(Btw, I know there is som开发者_高级运维e trick with authentication and a default URL in it but that won't work in this case.)


The problem with the URL you would like to have is that IIS6 would require that a physical resource exist on disk, unless you've configured IIS6 to route all requests through ASP.NET. From your statement this would appear to not be the case.

So, assuming that IIS6 is not routing all requests to the ASP.NET pipeline, then there will be no way of providing the exact URL you are wanting.

I encountered a similar dilemma before and overcame it by modify my routes to include a dummy .aspx extension so that IIS6 would be happy. Is there a reason you couldn't modify your desired URL to contain an extension that IIS6 does route to ASP.NET?

0

精彩评论

暂无评论...
验证码 换一张
取 消