我需要将应用程序中的一些旧页面重定向到新页面。我认为web.config中的urlMapping是实现此目的的有效方法。但也有另一种使用global.asax重定向的方法。哪一个是有效的方法。在请求执行的什么时候,这个asax和config文件会出现在图片中?哪个重定向更好 - web.config或global.asax
1
A
回答
1
如果我映射现有的网页,以新的我会守在原地的旧网页并刷新301永久重定向到客户端。这将保留搜索引擎优化,假设这是一个公共网站。
Response.StatusCode = 301;
Response.Status = "301 Moved Permanently";
Response.RedirectLocation = location; // static, configuration, or database
Response.End();
总的来说,我会去重新路由而不是重写。这两个伟大的链接:
对于一些不同的方法重新路由之前的概述检查出Scott Gu's Tip/Trick: Url Rewriting with ASP.NET
0
使用URL Rewrite ISAPI筛选器进行重定向 - 它是较低级别的并且将首先运行,因此您不会在asp.net引擎中受到攻击。
我链接的页面也提到ASP.NET路由,它们之间的差异以及如何在两者之间进行选择。
0
以下是通过HttpHandler编写重定向的方法之一。
http://www.developerfusion.com/article/4643/implementing-http-handlers-in-aspnet/
相关问题
- 1. 哪个更好:meta-refresh-url-redirect或htaccess 301重定向?
- 2. 404重定向或更好的选择
- 3. 哪一个更好:web.config或application_error中的CustomErrors?
- 4. 重定向从Global.asax中
- 5. 从Global.asax文件重定向
- 6. Web.Config 301重定向
- 7. 哪个更好?加入或列绑定?
- 8. NodeJS + jQuery:POST后重定向:客户端或服务器 - 哪个更好?
- 9. 将http重定向到https。哪个更好,为什么?
- 10. min或gzip,哪个更好?
- 11. 哪个更好? OpenCyc或ConceptNet?
- 12. 哪个更好,Nagios或Sensu?
- 13. jqGrid或dataTable,哪个更好?
- 14. PHP:ParseCSV或PHPExcel哪个更好?
- 15. DataTable或IList?哪个更好?
- 16. 哪个更好? city.state.id或city.state_id
- 17. PigServer或PigRunner?哪个更好?
- 18. 哪个更好H2或HSQLDB?
- 19. 哪个更好:PooledConnectionFactory或CachingConnectionFactory?
- 20. 哪个更好Paperclip或CarrierWave?
- 21. 哪个更好Math.random()或UIDUtil.createUID()
- 22. 哪个更好BOOST_MPL_ASSERT或BOOST_STATIC_ASSERT?
- 23. Magento或Prestashop,哪个更好?
- 24. Gzip或ob_flush()?哪个更好?
- 25. Japid或Scala哪个更好?
- 26. 哪个更好c89或c99
- 27. Coredata或Sqlite哪个更好
- 28. 哪个更好... GATE或RapidMiner
- 29. 哪个更好 - PyInstaller或cx_Freeze?
- 30. 哪个更好:Parcelable或Context?
你能提供的URL类型的更多细节。你想重定向? – Kane 2010-02-01 08:37:52
我想将www.somesite.com/abc/123.aspx等网页重定向到www.somesite.com/def/123.aspx – 2010-02-01 08:44:16