Redirect from MVC to web form (.aspx)

How to redirect from MVC application to ASP.Net Web Forms application with the same solution.

I tried some method like this

[HttpPost]
    public ActionResult Home(LoginUser lu)
    {
        return Redirect("http://localhost:51410/SessionWebFrom/Login.aspx");
    }

      

But got an exception: 404 Error

Server error in application "/".

Resource is not found.

Description: HTTP 404. The resource you are looking for (or its dependencies) may have been deleted, its name changed, or is temporarily unavailable. Review the following URL and make sure it is spelled correctly.

Requested URL: /SessionWebFrom/Login.aspx

+3


source to share


1 answer


There is only a small tweak to get it working: instead of using, relative URL

use a URL relative to the application root ~

, like this:

return Redirect("~/SessionWebFrom/Login.aspx")

      



If it doesn't:

The only problem might be with some configuration .config

+2


source







All Articles