Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 3rd, 2003, 09:22 PM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help!About Cookies

I have a class,I want to read the cookies with the class code,The class haven't the aspx pages.
The class code like this:

class HDLab
    dim membername

    public sub new()
        if not (context.Request.Cookies("HDLab") is nothing) then
           membername=context.request.cookies("HDLab")("membe rname")
        end if
    end sub
end class

when I run the code,It's have this errors:
System.NullReferenceException

  #2 (permalink)  
Old September 4th, 2003, 08:19 AM
Authorized User
 
Join Date: Jul 2003
Location: Calgary, Alberta, Canada.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

'Nothing' is not the same as 'DBNull'. Try changing your if statement to this:

if not (context.Request.Cookies("HDLab") is System.DBNull.Value) then...

If you are using code behind you also have to add 'Imports System.DBNull' to the top of your code.

  #3 (permalink)  
Old September 9th, 2003, 08:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Quote:
quote:Originally posted by CraigJones
 'Nothing' is not the same as 'DBNull'. Try changing your if statement to this:

if not (context.Request.Cookies("HDLab") is System.DBNull.Value) then...

If you are using code behind you also have to add 'Imports System.DBNull' to the top of your code.

Even if you call its full path, "System.DBNull", you still have to import it?
 


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
Cookies hastikeyvan Classic ASP Professional 5 May 29th, 2006 07:36 AM
Should I use cookies?? Help Tee88 Classic ASP Basics 3 January 21st, 2005 12:33 AM
Cookies shabboleth Beginning PHP 3 December 30th, 2003 10:32 AM
Cookies cjo ASP.NET 1.0 and 1.1 Basics 1 November 8th, 2003 02:38 PM



All times are GMT -4. The time now is 05:31 PM.


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