如何从WebForms重定向到MVC视图? [英] How to Redirect From WebForms to a MVC View?
本文介绍了如何从WebForms重定向到MVC视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在MVC应用程序中使用ASP.net WebForm.
我需要从WebForm按钮单击事件重定向到MVC视图或控制器中的ActionResult方法.
有办法吗?
I use an ASP.net WebForm in a MVC application.
I need to redirect to a MVC View or to an ActionResult method in a Controller from WebForm Button Click Event.
Is there a way to do this?
public ActionResult Index()
{
//Method in MVC Controller
//Rest of the code
}
尝试如下以重定向到Controller中的方法:
Tried as below to redirect to a method in Controller:
protected void btnCreate_Click(object sender, EventArgs e)
{
Response.Redirect("~/BreakdownReports/Index",false);
Context.ApplicationInstance.CompleteRequest();
}
推荐答案
尝试:
Response.Redirect("BreakdownReports/Index");
也
Response.Redirect("./BreakdownReports/Index");
这篇关于如何从WebForms重定向到MVC视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文