I have a Login.aspx page where I use Forms Authentication to login to the site. I use a cookie to store the additional user data and in the next page I use Asynchronous web-api calls to get some data. In the process I read the cookie and the user data. If the user data is found I proceed and if not I want to logout the user and redirect them to login page. I have the following code but the execution of the web-api call continues.
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
HttpContext.Current.Response.End();
How do I make the user log out and redirect to login page when I know that the cookie is not found?
You should check for the cookie before you make the Web API calls.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.