0

How do I call diffrent controller action method in mvc from webforms

I have created a controller having method name test and created another project in the same solution this time the webform and added the reference of the mvc application to the application and in page load of webform i wrote Response.RedirectToRoute("~/Home/Test");

this test method dosen't gets called

  • 1
    Can you provided more code so you have a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve)? – Leon Jun 13 '16 at 11:12
  • Do you want to call one controller method into another controller ? http://stackoverflow.com/questions/19172617/call-controllers-from-one-project-to-another-project – Abdul Jun 13 '16 at 11:30

1 Answers1

0

In a.Net solution you can have many web Applications. If you are referencing library project in a Web Application then you should have one Web root and one web site home page (http://localhost:1111). But if you have many web applications in one solution, each web application is as one standalone website, so each will have a unique home page like may be http://localhost:1111 (webforms application), http://localhost:1112 (MVC application). the ~/Home/Test in the webform project won't find anything because ~ mean the root of the current project(Webforms) which is http://localhost:1111, so the application should be looking at http://localhost:1111/Home/Test other than http://localhost:1112/Home/Test but the ~/Home/Test is in another webapplication. I think that it where you are having problem. I think you should redirect to the full URL to get to another project http://localhost:1112/Home/Test

Tchaps
  • 865
  • 7
  • 21