简体   繁体   中英

Cookie-based Forms Authentication with Cookies disabled

In my ASP.NET 4.0 Web Forms Application I'm working with forms authentication, and Cookieless is set to UseCookies . The Login control in out web project does not display an error message if cookies are disabled in the user's browser.

Is there a way to catch this error elegantly, in order to display a nice error message to users? Just "not logging in" is a bit confusing go them, obviously.

As far as I know there are no asp.net shipped in way to detect is cookies disabled on the client. But there are several ways to detect it 'by hand'. Example1 example2

Check out the answer by @Software Monkey and @thomasrutter on this post How to detect server-side whether cookies are disabled

These are the best approaches.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM