MVC重定向
1、现有系统:登录=>首页
2、需要做个对接系统,对方只要一个用户名和我提供的一个Appkey就能登录进来,因为没有密码,就不能重用现有的LoginController,所以要新建一个Controller来中转,
根据AppKey和用户名校验,获取模拟的一个User信息,然后重定向到首页。
public class LoginController : BaseController { // // GET: /Login/ [AllowAnonymous] public ActionResult Index() { Session["UserID"] = Guid.NewGuid(); Session["UserType"] = 1; Session["LoginTime"] = DateTime.Now.ToString("yyyyMMddHHmmssffff"); Session["UserCName"] = "zzz"; Session["InstitutionName"] = "abc"; SessionAdapter[BaseControllerEngine.CUR_USER_SESSION_NAME] = new LoginReqParam { UserID = Guid.NewGuid().ToString(), UserName = "123" }; SessionAdapter[BaseControllerEngine.CUR_USER_RES_NAME] = new UserRes(); return Redirect("~/dashboard.html"); } }