using Newtonsoft.Json; using Org.BouncyCastle.Utilities; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MQTTServerSideAPI.Controllers { public class BaseController : Controller { /// /// 在Action方法调用前使用,使用场景:如何验证登录等。 /// /// protected override void OnActionExecuting(ActionExecutingContext filterContext) { try { base.OnActionExecuting(filterContext); if (Session["username"] == null) { filterContext.Result = new RedirectResult("/LoginViews/Index"); } else { } } catch (Exception ex) { Logger.LogCalloutanaSide("Session:__________________" + ex); } } } }