so I have this code:
Try
If Request.Cookies("curUsrId")("id") Is Nothing Then
Dim cke As HttpCookie = New HttpCookie("curUsrId")
cke("id") = CStr(myUser.Id)
cke.Expires = Now.AddDays(35)
Response.Cookies.Add(cke)
Else
If Request.Cookies("curUsrId")("id") = "2" Then
grdIssues.SettingsPager.Mode = DevExpress.Web.ASPxGridView.GridViewPagerMode.ShowAllRecords
chkPaging.Checked = True
Else
grdIssues.SettingsPager.Mode = DevExpress.Web.ASPxGridView.GridViewPagerMode.ShowPager
chkPaging.Checked = False
End If
End If
Catch ex As Exception
lblErrorMsg.Visible = True
txtErrorTxt.Visible = True
txtErrorTxt.Text = ex.Message
End Try
I'm trying to read/write to a cookie, but everytime I run this, I get a "Object not set to an instance of an object" error.
Does anyone know why?
I changed the code slighty, still the same error? Per the comment below, I do check to see if the value is nothing.
Try
If Request.Cookies("curUsrId").Value Is Nothing Then
Dim cke As HttpCookie = New HttpCookie("curUsrId")
cke.Value = CStr(myUser.Id)
cke.Expires = Now.AddDays(35)
Response.Cookies.Add(cke)
Else
If Request.Cookies("curUsrId").Value = "2" Then
grdIssues.SettingsPager.Mode = DevExpress.Web.ASPxGridView.GridViewPagerMode.ShowAllRecords
chkPaging.Checked = True
Else
grdIssues.SettingsPager.Mode = DevExpress.Web.ASPxGridView.GridViewPagerMode.ShowPager
chkPaging.Checked = False
End If
End If
Catch ex As Exception
lblErrorMsg.Visible = True
txtErrorTxt.Visible = True
txtErrorTxt.Text = ex.Message
End Try
ANOTHER EDIT:
I added a breakpoint at the Try line, guess, what it doesn't hit. "No symbol information loaded etc". I tried loading the DLL manually, I've rebuilt the solution etc, no difference?