static void Main(string[] args) { AuthenticationInstance ai = new AuthenticationInstance(); ai.UserName = "******"; ai.PassWord = "******"; ai.TimeStamp = 1; string token = AuthenticationUtil.GenCookieToken(ai); AuthenticationUtil.Verify(token); }
static void Main(string[] args) { string json = "{\"UserName\":\"a\",\"PassWord\":\"b@@##$?b\",\"TimeStamp\":1}"; DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(AuthenticationInstance)); MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(json)); AuthenticationInstance aii = ser.ReadObject(ms) as AuthenticationInstance; string token = AuthenticationUtil.GenCookieToken(aii); //AuthenticationUtil. //string tokdden=@"FoluB\/oYyXPTbFCRTrJMbwBodY4jR1RwVtGSXCtrxa4OjeIsovSI0nihqPXllAUdHTW9dNuOuaIk5Xb93dqDG6Ld6qnuRTeuXp0hpFrbwkwOataMcS2NwE9NCcgQZlH4IjdCjds7euP5kxzWjPVmWiP67YJz4zVQieQ6iJDLEIs="; AuthenticationUtil.Verify(token); }
public FunctionPointList GetRoot() { string token = HttpContext.Current.Request.Headers[AuthenticationUtil.Dashboard365TokenName]; EventLog log = new EventLog("MyEvent"); // 首先应判断日志来源是否存在,一个日志来源只能同时与一个事件绑定s if (!EventLog.SourceExists("New Application")) { EventLog.CreateEventSource("New Application", "MyEvent"); } log.Source = "New Application"; log.WriteEntry("token" + token, EventLogEntryType.Information); if (!AuthenticationUtil.Verify(token)) { return(null); } FunctionPointList l = new FunctionPointList(); FunctionPoint s = new FunctionPoint(); s.Title = "Users Management"; s.ImgUrl = "/staticImages/users.png"; s.AlertCount = "3"; s.Description = "Users Management Component"; s.NavigationUrl = "/s.htm"; l.Add(s); FunctionPoint s2 = new FunctionPoint(); s2.Title = "Users Management"; s2.ImgUrl = "/staticImages/users.png"; s2.AlertCount = "3"; s2.Description = "Users Management Component"; s2.NavigationUrl = "/s.htm"; l.Add(s2); return(l); }