我使用自己的身份验证方案,不是基于cookie。我希望能够手动设置用户名和其他数据的Controller.User.Identity,我通常会设置在一个FormsAuthentication曲奇。目前,用户身份是由FormsAuthentication设置的(我不知道如何设置,它只是从加密的cookie中读取)。FormsAuthentication如何做到这一点呢?我该怎么做呢?
发布于 2012-10-22 02:50:18
System.Web.HttpContent.Current.User = new GenericPrincipal(
new GenericIdentity("username", "CUSTOM"),
new string[]());
System.Threading.Thread.CurrentPrincipal = System.Web.HttpContent.Current.User;https://stackoverflow.com/questions/13000964
复制相似问题