我正在使用具有匿名身份验证的ASP .Net应用程序,需要在web.config
文件中设置HttpContext.Current.User.Identity.Name
的值,因此需要为每个请求分配该值。
The HttpContext.Current.User object is for .Net Frameworks integrated authentication framework only (using Forms- or Windows-Authentication) and can not be set programmatically. If you need a value from the web.config in every request I would suggest to just read the value set in the web.config using
System.Configuration.ConfigurationManager.AppSettings[key]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.