开发者

URL Redirects in ASP.NET

开发者 https://www.devze.com 2022-12-17 13:33 出处:网络
Ok, wierd problem I cant figure out. Hopefully someone where can. I have inherited a site that was developed with a very over-architected Content Management System. I am having problems now with the r

Ok, wierd problem I cant figure out. Hopefully someone where can. I have inherited a site that was developed with a very over-architected Content Management System. I am having problems now with the redirection functionality built into it.

This is on a dedicated Windows 2003 server running ASP.NET 3.5 sp 1. The redirects are stored in the database, and I have confirmed that the correct redirect is in place in the database. Finally, th开发者_运维问答e file extension .html has been mapped in IIS to the ASP.NET ISAPI. And there is an HttpHandler created to redirect the .html requests. The default documents on the server, in order, are:

  • default.aspx
  • index.aspx
  • default.asp
  • index.asp
  • default.html
  • index.html

for this example, we have two redirects both pointing to the same content page. /example and /example.html

when requesting /example.html it correctly finds the appropriate redirect in the database and does its magic. Bueno. When requesting /example it gives a 404 page. Its not even the asp.net yellowish 404 generic error page. Its the standard vanilla IIS 404 response so it appears that asp.net is not intercepting these requests.

Let me know if any other information is requested and I will try to provide what I can. Thanks in advance for all the great recommendation I am sure will come from the community.


You should be able to map a wildcard extension to go through the ASP.Net ISAPI DLL is the solution.

Installing Wildcard Application Mappings (IIS 6.0) may also be useful.


Without rewriting the CMS, you can put a physical file in a new directory "/example". This will trigger ASP.NET to intercept the request, and hopefully load your page.

If you want to really hack it up you can change the IIS 404 page to be a .NET page in your application that can handle the original request and redirect to the page you really want.


Yes this is correct because /example is not pointing to any file, it is pointing to directory in the web server. Check that Default.aspx/ default.html or any other atleast one of them exists in your app.

If you are using ASP.Net MVC for REST then check your actions are properly written.

0

精彩评论

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