Added HttpException class for missing HttpException for net8 Wrapped HttpContext.Session, GetJsonResult, IsAjaxRequest and GetUserIdentityName in controllers for net8 Added AuthenticationService to test Fab2ApprovalMKLink code for net8 Compile conditionally flags to debug in dotnet core
38 lines
1003 B
C#
38 lines
1003 B
C#
#if !NET8
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
#if !NET8
|
|
using System.Web.Mvc;
|
|
#endif
|
|
|
|
namespace Fab2ApprovalSystem.Misc {
|
|
|
|
public class SessionExpireFilterAttribute : ActionFilterAttribute {
|
|
public override void OnActionExecuting(ActionExecutingContext filterContext) {
|
|
HttpSessionStateBase session = filterContext.HttpContext.Session;
|
|
HttpContext ctx = HttpContext.Current;
|
|
|
|
|
|
// check if session is supported
|
|
|
|
if (GlobalVars.IsUserNameNull(session)) {
|
|
// check if a new session id was generated
|
|
|
|
// this will force MVC to use the standard login redirect, enabling ReturnURL functionality
|
|
System.Web.Security.FormsAuthentication.SignOut();
|
|
filterContext.Result = new System.Web.Mvc.HttpUnauthorizedResult();
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
base.OnActionExecuting(filterContext);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif |