【发布时间】:2020-07-22 20:41:22
【问题描述】:
我使用 ASP.NET MVC。我有个问题。我将变量设置为会话,并请求不属于我的 Web 服务。然后 Web 服务向我的服务器发出 HttpPost 请求。
它不会向我的服务器发送 cookie,所以我失去了会话。
我想我可以将我的sessionid 保存到数据库中,然后我可以用这个 ID 恢复我的会话。但我无法得到任何解决方案。
你有什么建议?
public ActionResult SomeAction(){
mySettingService.saveSessionIdToDb(someToken, Session.SessionID);
var myPaymentFormObj = FormInit.Create(request, options);
myPaymentFormObj.DoRequest(); //it's callback to my another action with a token
}
[HttpPost]
public ActionView MyCallBack(string someToken){
//here is our app generates new session id and i lost my session because other server doesn't send me session id.
//i need to read session id from db and i can get my session maybe.
var mySessionId = mySettingService.getSessionIdFromDb(someToken);
//how can i start session like this?
Session.SessionID = mySessionId;
}
【问题讨论】:
-
您发布的
SomeAction是否负责将请求发送到您提到的网络服务器?
标签: c# asp.net asp.net-mvc session transactions