【发布时间】:2015-02-26 15:59:18
【问题描述】:
这是一个令人头疼的问题:
我有一个 Dotnet 应用程序,它会在某个非活动时间段后将用户注销。使用相关 CSHTML 中定义的操作的 JavaScript 函数将用户发送到某个控制器方法,该方法将注销用户。
当 JavaScript 代码决定用户应该退出时,它使用以下行来执行此操作:
location.href = settings.actions.expireSession + '?returnUrlString=' + currentUrl;
其中 settings.actions.expireSession 定义为:
expireSession: '@Url.Action("Expire", "Session")'
进入 location.href 的返回 url 字符串如下所示:
http://localhost:49574/Report/ReportWithUserIdAndCaseId?userId=84&caseId=173
这是正确的,与 url 动作组合在一起的整个字符串如下所示:
"/Session/Expire?returnUrlString=http://localhost:49574/Report/ReportWithUserIdAndCaseId?userId=84&caseId=173"
我在相关方法的入口处设置了一个断点,但是到达名为“returnUrlString”的字符串参数中缺少“caseId”:
http://localhost:49574/?returnUrl=http%3A%2F%2Flocalhost%3A49574%2FReport%2FReportWithUserIdAndCaseId%3FuserId%3D84
因此,当我输入用户名和密码重新登录时,我会被重定向到以下网址:
http://localhost:49574/Report/EntrySummaryReportWithPatientIdAndVisitId?userId=84
因为缺少关键参数而失败。
我错过了什么明显的东西吗?在 Dotnet 的寻址/重定向系统的自动化背景中是否还有其他东西可能导致这种神秘的消失?
非常感谢大家阅读本文,并非常感谢贡献者! - 伊利亚
【问题讨论】:
标签: javascript .net