Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Has there been any change in Cookie behavior

Reply
Thread Tools

Has there been any change in Cookie behavior

 
 
cowznofsky
Guest
Posts: n/a
 
      03-11-2009
Here is some code from an app written in VS2003

'Cookie will be "in memory" only, not written to user's
'PC. This happens by simply NOT specifying an
'expiration time.
Response.Cookies("OOI")("UserID") = Me.txtUserID.Text

I've migrated the app to VS2008, and am getting an error ("Object
reference not set to an instance of an object")when using this code on
a separate page:

sCookie = Request.Cookies("OOI")("UserID").ToString()


Now, the code works (1) on my dev machine and (2) if I get onto the
host server and get into IE and run it there.
I get the error only when I connect to the app from another machine.
Otherwise everything else works fine.

Could there have been some change along the way from ASP.NET 1.1 to
2.0?

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      03-13-2009
On Mar 11, 8:41*pm, cowznofsky <(E-Mail Removed)> wrote:
> Here is some code from an app written in VS2003
>
> * * * * 'Cookie will be "in memory" only, not written to user's
> * * * * 'PC. This happens by simply NOT specifying an
> * * * * 'expiration time.
> * * * * Response.Cookies("OOI")("UserID") = Me.txtUserID.Text
>
> I've migrated the app to VS2008, and am getting an error ("Object
> reference not set to an instance of an object")when using this code on
> a separate page:
>
> * * * * sCookie = Request.Cookies("OOI")("UserID").ToString()
>
> Now, the code works (1) on my dev machine and (2) if I get onto the
> host server and get into IE and run it there.
> I get the error only when I connect to the app from another machine.
> Otherwise everything else works fine.
>
> Could there have been some change along the way from ASP.NET 1.1 to
> 2.0?


I think Request.Cookies("OOI")("UserID") returns null when cookies are
not presented and you get an error because of this. Did you check
before that line

If Not Request.Cookies("OOI") Is Null And Not Request.Cookies("OOI")
("UserID") Is Null Then

....

?
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any one who has been working with java for a long long time? Amanda Java 26 11-11-2006 12:43 AM
The printing has been stopped and this job has been add to the queu? dejola Computer Support 6 12-30-2005 03:26 AM
I need help I has been over 6 months since I've been able to do the system check for updates Marc Computer Support 8 07-25-2005 07:04 PM
has there been any word on "VIBES"? Bratboy DVD Video 3 04-27-2004 09:08 PM
Checking if a cookie has already been set Andrew Duffy ASP General 2 10-10-2003 03:08 AM



Advertisments