Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-31180-6
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 23rd, 2014, 03:28 PM
Authorized User
Points: 416, Level: 7
Points: 416, Level: 7 Points: 416, Level: 7 Points: 416, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default cookie setting in chapter 6

Hi Imar,

Terrific book! Thanks! Things are going pretty much as your teaching/examples teach.

Regarding cookies in the "Dynamically Switching Themes" "Try It Out", the code (I'm using VB) sets a string "PreferredTheme" for the cookie, but when I check cookies, that's not the name of the cookie, it's something inside the cookie.

Where is the name of the cookie file set?

If I need to ask this on a different forum, let me know.

Thanks.

Best Regards,
Alan
 
Old January 24th, 2014, 03:05 AM
EricCulbertson
Guest
 
Posts: n/a
Default

appreciate sharing the book as i am reading the book and getting the desired support from it
 
Old January 27th, 2014, 11:51 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Alan,

Not sure what you mean. Where are you checking the cookies?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 27th, 2014, 12:14 PM
Authorized User
Points: 416, Level: 7
Points: 416, Level: 7 Points: 416, Level: 7 Points: 416, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default Cookie location

Hi Imar,

Windows 8. Using IE10 > Internet Options > General tab > Browsing History Settings > View Files.

The path to the directory is also displayed on the General tab, but that directory can't be seen in Windows Explorer unless, in folder options, we uncheck "Hide protected operating system files (Recommended)"; but it's there. For me unchecking that box creates a lot of screen clutter I don't really need.

When I sorted the files by date, I quickly found the cookie created by the WROX website we're working on. Mine is named "Cookie:alan@localhost/" and it contained:
PreferredTheme
Monochrome
localhost/
1024
766503552
30367738
2790271197
30349641
*

I just presumed there is a way in ASP.NET to set the name of the cookie which would be pretty valuable. I always find it frustrating to not be able to locate a cookie by name when its not named in association with the website that generated it. I wanted to set the cookie name to "wrox...<something>". But I might lack some key understanding of how that name is being set.

Thanks.

Best Regards,
Alan
 
Old January 27th, 2014, 12:16 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The name of the file is controlled by the browser and typically uses the domain name for the site (localhost in your case). All you should be concerned with (and have control over) is the name of the cookie, which is PreferredTheme in this case.

Cheers.

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old January 27th, 2014, 12:33 PM
Authorized User
Points: 416, Level: 7
Points: 416, Level: 7 Points: 416, Level: 7 Points: 416, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
Default Got it

Alan is my user account name in which I am running the website, and the domain is "localhost".

So I think you are teaching me that when I go live with a real domain name that will be put into the cookie.

Thanks.

Best Regards,
Alan
 
Old January 27th, 2014, 03:07 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, it depends. Browsers are free to store cookies the way they want. IE uses files, Firefox used to use a single file called Cookies.txt and now uses a small database. So how the cookie is stored is something you can't control.

What gets stored is something you do control, things like the name, the value and the expiry date can all be set when you create the HttpCookie.

Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!




Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 6: theme cookie expires at the end of the session Antonius Block BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 March 6th, 2012 06:02 AM
Chapter 3 - Setting up a new site abrown BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 1 January 6th, 2009 06:43 AM
Set Cookie Chapter 8 ? phirun BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 13 May 27th, 2005 11:19 AM
Problem with set cookie chapter 8 stephen_c_ BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 December 15th, 2004 02:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.