gpt4 book ai didi

asp.net - 如何处理 ASP.NET 站点中的 ASP 请求?

转载 作者:可可西里 更新时间:2023-11-01 17:15:20 25 4
gpt4 key购买 nike

我有一个托管在 ASP.NET 环境中的网站。该网站目前能够处理 .aspx 请求。如果用户请求服务器中不存在的 .aspx 页面,那么我可以将他/她重定向到一般错误页面。

现在的问题是,如果用户请求 .asp 页面,例如,如果用户输入

http://wwww.example.com/index.asp

然后错误处理程序不起作用。我想把他/她重定向到这里,

http://wwww.example.com/index.aspx

我怎样才能做到这一点?

提前致谢。

最佳答案

对于 permanent redirect

Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www.new-url.com/"

this

Response.Redirect "http://www.new-url.com/"

关于asp.net - 如何处理 ASP.NET 站点中的 ASP 请求?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4122331/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com