如何从包含值列表的 HttpContext.Current.Session["PaTSUA"] 中获取特定值?
How to get a specific value from HttpContext.Current.Session["PaTSUA"] whch contains a list of values?
我想 select 来自会话变量的特定值。我怎样才能从这个会话中得到那个值
var tz = HttpContext.Current.Session["PaUA"];
这是我正在使用的代码。当我立即执行此操作时 window 它显示的结果如下
{PS.UserInterface.Models.UA}
ApplicationID: {de151484-f822-4692-a36b-e7e1fc1066fe}
CompanyID: {fef3fb8e-365f-4cc4-8976-ff9e5ed1516c}
DBConnectionString: "Data Source=WIN-ISPHTIHPJFI\MSSQLSERVER2016;Initial Catalog=PSDefault;User ID=dba;Password=dba@2018"
DefaultModuleID: {00000000-0000-0000-0000-000000000000}
IsMainContractor: true
LicenseID: {ac258d7d-25dc-44f9-b798-2d4657d68c95}
LicenseType: "MultiUser"
LoginName: "suvaneeth"
LoginTime: "11-Apr-2019 18:39:34"
RolesCSV: "SAAdmin"
ThemeCode: "Liquid"
TimeZone: "Dateline Standard Time"
UserID: {fc938df0-8a4e-4c85-b93c-be51373c559f}
UserName: "Suvaneeth S"
UserProfileID: {fc938df0-8a4e-4c85-b93c-be51373c559f}
UserWeekStartDay: "1"
licenseModuleCSV: "830683B5-6D12-4AF9-AF76-7013A930AA0D,F774DF88-C2D6-4527-8A0E-493E1E1D3120"
但我不知道如何从这个结果中获取时区
最简单的方法是这样做:
static void Main(string[] args)
{
var test = new test { abc = "asdasdasd" };
var xx = (dynamic)test;
Console.WriteLine(xx.abc);
}
class test
{
public string abc { get; set; }
}
所以对你来说:
var tz = HttpContext.Current.Session["PaUA"];
var xx = (dynamic)tz;
var zone = tz.TimeZone;
只需转换为 UA class 赞;
var tz = (PS.UserInterface.Models.UA)HttpContext.Current.Session["PaUA"];
var timezoneValue= tz.TimeZone;
我想 select 来自会话变量的特定值。我怎样才能从这个会话中得到那个值
var tz = HttpContext.Current.Session["PaUA"];
这是我正在使用的代码。当我立即执行此操作时 window 它显示的结果如下
{PS.UserInterface.Models.UA}
ApplicationID: {de151484-f822-4692-a36b-e7e1fc1066fe}
CompanyID: {fef3fb8e-365f-4cc4-8976-ff9e5ed1516c}
DBConnectionString: "Data Source=WIN-ISPHTIHPJFI\MSSQLSERVER2016;Initial Catalog=PSDefault;User ID=dba;Password=dba@2018"
DefaultModuleID: {00000000-0000-0000-0000-000000000000}
IsMainContractor: true
LicenseID: {ac258d7d-25dc-44f9-b798-2d4657d68c95}
LicenseType: "MultiUser"
LoginName: "suvaneeth"
LoginTime: "11-Apr-2019 18:39:34"
RolesCSV: "SAAdmin"
ThemeCode: "Liquid"
TimeZone: "Dateline Standard Time"
UserID: {fc938df0-8a4e-4c85-b93c-be51373c559f}
UserName: "Suvaneeth S"
UserProfileID: {fc938df0-8a4e-4c85-b93c-be51373c559f}
UserWeekStartDay: "1"
licenseModuleCSV: "830683B5-6D12-4AF9-AF76-7013A930AA0D,F774DF88-C2D6-4527-8A0E-493E1E1D3120"
但我不知道如何从这个结果中获取时区
最简单的方法是这样做:
static void Main(string[] args)
{
var test = new test { abc = "asdasdasd" };
var xx = (dynamic)test;
Console.WriteLine(xx.abc);
}
class test
{
public string abc { get; set; }
}
所以对你来说:
var tz = HttpContext.Current.Session["PaUA"];
var xx = (dynamic)tz;
var zone = tz.TimeZone;
只需转换为 UA class 赞;
var tz = (PS.UserInterface.Models.UA)HttpContext.Current.Session["PaUA"];
var timezoneValue= tz.TimeZone;