您的帮助将是适用的
在我们的Web应用程序中,我们有一个名为" ExternalLogin"这是MVC控制器中的Post方法
public ActionResult ExternalLogin(FormCollection collection)
{
//Here we set bunch of Temp Data (I know it is bad but it is what it is)
var ovm = TempData["optionsVm"];
ovm.Prop1 = "SomeValue";
ovm.Prop2 = "SomeOtherValue";
.
.
.
//then we assign back
TempData["optionsVm"] = ovm;
//we do then ADFS Authentication Challenge as below and it works
var ctx = Request.GetOwinContext();
string provider = "ADFSProvider";
//ctx.Authentication.SignOut();
ctx.Authentication.Challenge(
new AuthenticationProperties
{
RedirectUri =
Url.Action("**LoginCallbackBerkleyMarineAdfs**", "Account", new { provider })
},
provider);
return new HttpUnauthorizedResult();
}
public ActionResult LoginCallbackBerkleyMarineAdfs(FormCollection collection)
{
//Here TempData["optionsVm"] is null
}
在从ADFS重定向之前,我在外部登录方法中使用了TempData.Keep(" optionsVm")和TempData.Peek(" optionsVm")但无效。
它可以在某个时间运行,但在其他时间不起作用。真的很痛苦。
希望我能从你们那里得到答案。谢谢。
-------------有关如何设置和阅读TempData [" OptionsVm"]的更多信息
@{
QuickQuoteForm optionsVm = (QuickQuoteForm)TempData["optionsVm"];
}
<form id="ins-details" action="ExternalLogin" ...>
@Html.Hidden("equipmentDeductible", optionsVm.Deductible)
@{TempData["optionsVm"] = optionsVm;}
<form/>
当Form Get Posted时,它转到原始问题
中的外部登录方法