Guest User

Guest User

  • Tech Writer
  • 515
  • 46.4k

About checking Cookies on page load

Aug 18 2020 4:54 PM
hello,
 
Hope everyone is doing good.
 
I am working in mvc.
 
I have created cookie in browser after login.
 
So next time if i open login url in my browser, it should redirect to dashboard directly.
 
So i want to check cookies on login page load, i am trying this with below code :
  1. public ActionResult Login()  
  2. {  
  3. HttpCookie chkLoginCookie = Request.Cookies["Login"];  
  4. if (chkLoginCookie != null)  
  5. {  
  6. return RedirectToAction("Home""Dashboard");  
  7. }  
  8. else  
  9. {  
  10. return View();  
  11. }  
  12. }  
But it keeps on spinning and later ask to delete cookies.
 
Thank you in adv

Answers (1)