1
Answer

About checking Cookies on page load

Guest User

Guest User

4y
1.1k
1
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)