Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <caching>
- <outputCacheSettings>
- <outputCacheProfiles>
- <add name ="Long" duration="300"/>
- <add name ="Short" duration="3"/>
- </outputCacheProfiles>
- </outputCacheSettings>
- </caching>
- protected override bool AuthorizeCore(HttpContextBase httpContext)
- {
- User currentUser = (User)httpContext.Session["CurrentUser"];
- if (currentUser == null)
- {
- return false;
- }
- if (currentUser.Role == RolesEnum.User && _role == RolesEnum.Admin)
- {
- return false;
- }
- return true;
- }
- [HttpPost]
- public ActionResult Login(string username, string password)
- {
- User login = db.Users.Where(p => p.Username == username && p.Password == password).FirstOrDefault();
- if (login == null)
- {
- return View();
- }
- Session.Add("CurrentUser", login);
- return RedirectToAction("Index", "Projects", null);
- }
- [CustomAuthorize]
- [OutputCache(CacheProfile = "Long")]
- public ActionResult Index(string currentFilter, string searchTerm, int? page, string searchContainingText)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement