ASP.NET MVC 控制器操作是否比 HttpHandler 更快/更高效?
我正在尝试创建一个简单的轻量级服务器端重定向,它检查客户端的用户代理并重定向到给定浏览器的网站。例如:
if(Request.UserAgent.contains("Firefox") { //redirect to www.yahoo.com }
else if(Request.UserAgent.contains("Safari") { //redirect to www.google.com }
else { // redirect to www.msn.com }
使用 ASP.NET 实现此目的最高效/最高效的方法是什么?
I'm trying to create a simple lightweight server side redirect which inspects the client's User-Agent and redirects to a website for a given browser. For example:
if(Request.UserAgent.contains("Firefox") { //redirect to www.yahoo.com }
else if(Request.UserAgent.contains("Safari") { //redirect to www.google.com }
else { // redirect to www.msn.com }
What would be the most performant/efficient way of accomplishing this using asp.net?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不会。控制器在幕后实现 IHttpHandler 并使用反射来执行操作方法。
No. Controllers implement IHttpHandler behind the scenes and use reflection to execute action methods.