 |
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
|
|
|
|
|

January 23rd, 2014, 03:28 PM
|
|
Authorized User
|
|
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
|
|
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
|
|

January 24th, 2014, 03:05 AM
|
|
|
appreciate sharing the book as i am reading the book and getting the desired support from it
|
|

January 27th, 2014, 11:51 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Alan,
Not sure what you mean. Where are you checking the cookies?
Imar
|
|

January 27th, 2014, 12:14 PM
|
|
Authorized User
|
|
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
|
|
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
|
|

January 27th, 2014, 12:16 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|

January 27th, 2014, 12:33 PM
|
|
Authorized User
|
|
Join Date: Nov 2013
Posts: 84
Thanks: 29
Thanked 2 Times in 2 Posts
|
|
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
|
|

January 27th, 2014, 03:07 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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
|
|
 |
|