cshtml界面:
(当前页面在iframe框架中跳转出去我们需要调用window.parent.location="";)
(如果是普通页面之间跳转可以直接window.location.href="";)
跳转到action中可以Session.Clear();清除session
下面还有几种方式跳转,跳转传参
$("#languageTest").click(function () {
window.location.href = '@Url.Action("GetLanguageTestList", "UserOrgManager")';
});
如果页面之间跳转,无参数(有的需要):window.location.href='@Url.Action("方法名","controller名")';。
如果跳到方法,带参数(有的不需要):window.location.href='@Url.Action("方法名","controller名")?id='+id;
场景: 假如有几个tab需要实现跳转,即页面间跳转,则用到第一种方式。
假如要导出Excel,需要跳转到导出的方法,则可能需要带sql作为参数,则用到第二种方式。
补充:
window.location.href='@URL.Action("方法名","controller名")'和
window.location.href='/AdminManager/GetUserInfo'的效果是一样的。