Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
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
Reply With Quote
  #3 (permalink)  
Old January 27th, 2014, 11:51 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #4 (permalink)  
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
Reply With Quote
  #5 (permalink)  
Old January 27th, 2014, 12:16 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
  #6 (permalink)  
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
Reply With Quote
  #7 (permalink)  
Old January 27th, 2014, 03:07 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.