How to Check if cookies are enabled or disabled Part 61

  • دعنا نشارك هذا :
ترتيب الدرس : 61
المدة : 00:13:50
التحكم :
Text version of the video
http://csharp-video-tutorials.blogspot.com/2012/11/how-to-check-if-cookies-are-enabled-or.html

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1

Slides
http://csharp-video-tutorials.blogspot.com/2013/08/part-61-cookiesenabled-or-disabled.html

All ASP .NET Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html

All ASP .NET Slides
http://csharp-video-tutorials.blogspot.com/p/aspnet-slides.html

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists

Most of the articles on the internet, states we can use Request.Browser.Cookies property to check, if the cookies are enabled or disabled. This is incorrect.
if (Request.Browser.Cookies)
{
//Cookies Enabled
}
else
{
//Cookies Disabled
}

Request.Browser.Cookies property is used to check, if the browser supports cookies. Most mordern browsers, support cookies. Irrespective of whether, the cookies are enabled or disabled, if the browser supports cookies, Request.Browser.Cookies always returns true. So use this property to check if the browser supports cookies and not to check if the cookies are enabled or disabled.
if (Request.Browser.Cookies)
{
//Broswer supports cookies
}
else
{
//Broswer does not supports cookies
}

So, the next question is, how do we check, if cookies are enabled or disabled?
1. Write a Test Cookie
2. Redirect to the same page
3. Read the Test Cookie
4. If Cookies preseent - Cookies are enabled
5. Else - Cookies are disabled.

To disable cookies in Internet Explorer(IE 9)
1. Click on Tools
2. Select Internet Options
3. Click on the Privacy tab
4. Click the Advanced button, under settings
5. Check Override automatics cookie handling check box
6. Select Block radio button under First Party cookies and Third Party Cookie

The above steps disable cookies, only for the internet zone. If you are testing code on your local machine, and to disable cookies for localhost
1. Run the application
2. Press F12, to open developer tools
3. Then Select, Cache - Disable Cookies

سيتم تفعيل التعليقات قريبا

y
Sep 23, 2020 07:32:24
youtube