MVC3 URL重定向到新位置 [英] MVC3 URL redirect to new location
本文介绍了MVC3 URL重定向到新位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Asp.net MVC制作应用程序,
我有一个动态生成的网址,例如http:\ localhost:4351 \ username
我想要的功能是,如果用户将其复制到地址栏上,它将重定向到新的地址,例如
http:\ localhost:4355 \ users \ profile \用户名
我在其中定义了一个名为users的控制器和一个名为profile的操作
Hi,
I am making an application using Asp.net MVC,
I have a url which is generating dynamically like http:\localhost:4351\username
I want the functionality that if a user copy it on address bar it''ll redirect to a new address like
http:\localhost:4355\users\profile\username
I''ve a controller named users and an action named profile defined in it
How can i implement this functionality?
推荐答案
您可以通过路由实现它. http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx [ http://msdn.microsoft.com/en-us/library/cc668201.aspx [ ^ ]
You can implement it through routes.
http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx[^]
http://msdn.microsoft.com/en-us/library/cc668201.aspx[^]
这篇关于MVC3 URL重定向到新位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文