Hi, I'm have a little trouble with my cookies

I'm using cookies to hold session data. Mainly because I don't want the session to time out - If there is a way of using session vars without the session timing out then I'd love to hear about it.

Anyway my cookie may or may not have been set depending on where the user has been on the site. when I try to set the value I'm getting an error Object reference not set. I'm positive it's the cookie because I can see the MS_No in the querystring and the spelling etc. is all okay.

VB Code:
  1. If Not Page.IsPostBack Then
  2.   ' Get the cookies
  3.   Dim MS_No As HttpCookie = Request.Cookies.Item("MS_No")
  4.  
  5.   ' Check the query string for the ms #
  6.   If Not IsNothing(Request.QueryString("ms_no")) Then
  7.     If Request.QueryString("ms_no").ToString <> String.Empty Then
  8.       [HL="#FFFF00"]MS_No.Value = Request.QueryString("ms_no").ToString ' Set the instance value[/HL]
  9.       Response.Cookies("MS_No").Value = MS_No.Value ' Set the base value
  10.     End If
  11.   End If
  12. End If

All help will be greatly appreciated

Cheers Al