Redirecting from ASP.NET WebForms to MVC

2020-07-06 05:15发布

问题:

We have a large existing ASP.NET WebForms application, but we are now moving over to MVC.

Rather than go through a painful process of trying to integrate MVC into the existing app, we're looking at creating a brand new VS project to completely isolate the new code.

As a first step, we are wanting to use the existing login process of the WebForms app, then redirect over to the MVC app.

Does anyone know of an easy way to do this (i.e. redirect from a WebForms project to the MVC project, in the same VS solution)? All the information I've found so far suggests either starting from scratch in MVC, or combing MVC into the existing Webforms project - neither of which is very feasible.

Many thanks,

Paul

回答1:

Redirecting is the easy part: Response.Redirect("http://domain.com/mvc/home/index");. The more difficult part would be to set up a single sign on process so that when a user is authenticated on the legacy application he would be automatically authenticated on the new MVC application. Here's a nice article covering how to setup a SSO scenario between two ASP.NET applications.