1

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                                                    
}

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();                        
}
Asger
  • 3,822
  • 3
  • 12
  • 37

2 Answers2

0

try it I redirected from .aspx to MVC controller page

 protected void btnCreate_Click(object sender, EventArgs e)
        {                    
        var page = HttpContext.Current.Handler as Page;
         Response.Redirect(page.GetRouteUrl("Set hereDefaultroute", 
          new { Controller="BreakdownReports", Action="Index"}), false);               
        }
SUNIL DHAPPADHULE
  • 2,755
  • 17
  • 32
0

Try:

Response.Redirect("BreakdownReports/Index");

also

Response.Redirect("./BreakdownReports/Index");
Wildan Muhlis
  • 1,553
  • 2
  • 22
  • 43