Hi,
I want to write the below given common code in all the methods which return ActionResult in my controller. There are about 100 controllers in my application. What is the best way to handle this?
var currentloginInfo = RequestSessionCache.GetCurrentLoginInformationsAsync().Result;
if (currentloginInfo.Tenant.GetSubscriptionExpiringDayCount() < 0)
{
return RedirectToAction("SelectEdition", "SubscriptionManagement", new { editionPaymentType = "Upgrade" });
}
Regards, Abinesh
3 Answer(s)
-
0
Hi @pankajmathur,
Actually expired users are not logging in. When a tenant subscription expired, this user status is changing to Active=0 by a scheduled job. So you cant get "currentloginInfo" for expired user.
-
0
We have changed the default behavior as we would like to user to login within 30 days of expiry, however he will see only the payment screen and unless he has paid cannot goto any other controller page.
-
0
Ok, you can use actionfilters for this.
Check detailed explanation for actionfilters here: <a class="postlink" href="https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/filters">https://docs.microsoft.com/en-us/aspnet ... rs/filters</a>