Files
Web_F305_Mqtt_Prod/MQTTServerSideAPI/Controllers/BaseController.cs

42 lines
1.0 KiB
C#
Raw Normal View History

2025-11-26 11:32:30 +08:00
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
{
/// <summary>
/// 在Action方法调用前使用使用场景如何验证登录等。
/// </summary>
/// <param name="filterContext"></param>
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);
}
}
}
}