Hello...
i am using session in website and session expired time is 30 min ..but if some one access website continue from 30 min so how to reset time because its automatically logout..
this is my code
session Method :-
public class SessionExpire : System.Web.Mvc.ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (HttpContext.Current.Session["userid"] == null)
{
FormsAuthentication.SignOut();
HttpContext.Current.Session.Abandon();
filterContext.Result =
new RedirectToRouteResult(new RouteValueDictionary
{
{ "action", "Index" },
{ "controller", "Home" },
{ "returnUrl", filterContext.HttpContext.Request.RawUrl}
});
return;
}
}
}
This Is Controller:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ShopINdeal.Models;
using ShopINdeal.ViewModels;
using System.Data;
using System.Data.Entity;
using System.Web.Security;
using System.Data.Entity.Validation;
using System.IO;
using Microsoft.Ajax.Utilities;
using System.Net.Mail;
namespace ShopINdeal.Controllers
{
[SessionExpire]
public class WholeSaleController : Controller
{
public ShopINdealEntities4 db = new ShopINdealEntities4();
[HttpGet]
public ActionResult CreateWholeSale()
{
return View();
}
[HttpPost]
public ActionResult CreateWholeSale()
{
return View();
}
WebConfig:-


Malvik BhavsarRank #617 · 3.9K reputationPosted Dec 2, 2016, 2:21 AM EST
Please check following link for answer:
http://stackoverflow.com/questions/1431733/keeping-asp-net-session-open-alive
Malvik BhavsarRank #617 · 3.9K reputationPosted Dec 2, 2016, 1:55 AM EST
Dr.Ajay KashyapRank #2,900 · 496 reputationPosted Dec 2, 2016, 2:07 AM EST
Khaja MoizuddinRank #270 · 9.4K reputationPosted Dec 2, 2016, 2:10 AM EST