0

我在 httpcontext 中更改用户时遇到了一些麻烦。我首先运行一个模块并在那里设置声明主体,然后转到我的网络,然后读取声明主体。不幸的是,在我在模块中弄乱它之前,web from 读取用户时的状态。对其进行了调试,模块的末尾显示了我想要的 claimprincipal 是什么,所以我不知道我在哪里搞砸了。

模块.cs

HttpContext current1 = HttpContext.Current;
//Changing principal
current1.ApplicationInstance.CompleteRequest(); //This shows the right principal

webform.aspx.cs

claimsPrincipal = Page.User as ClaimsPrincipal; //Shows old principal
4

0 回答 0