Problem with accessing cookies?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lalitha1024

    Problem with accessing cookies?


    Hi,
    In my Asp.net project when i am login to my site, i'll set th
    cookies by using below commands.

    Dim IdCookie As New HttpCookie("emp id"
    ds.Tables(0).Ro ws(0).Item(0))
    Dim FnameCookie As New HttpCookie("emp name"
    ds.Tables(0).Ro ws(0).Item(1))
    Response.Cookie s.Add(IdCookie)
    Response.Cookie s.Add(FnameCook ie)

    In each and every page i wrote authorization by using belo
    statements.

    If Request.Cookies ("empid").Va lue = "" Then
    Response.Write( "<b> You are not authorised to view thi
    page...</b>")
    Server.Transfer ("employerlogin .aspx")
    End If

    when i am trying to execute pages separetely in browser i am gettin
    below error. i am copying here my total error page.

    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution o
    the current web request. Please review the stack trace for mor
    information about the error and where it originated in the code.

    Exception Details: System.NullRefe renceException: Object reference no
    set to an instance of an object.

    Source Error:


    Line 24: Private Sub Page_Load(ByVal sender As System.Object, ByVa
    e As System.EventArg s) Handles MyBase.Load
    Line 25: Dim id As String
    Line 26: id = Request.Cookies ("empid").Va lue
    Line 27: 'If CType(Response. Cookies("empid" ).Value, String)
    "" Then
    Line 28:


    Source File: c:\inetpub\wwwr oot\Gotsap\emph ome.aspx.vb Line: 26

    Stack Trace:


    [NullReferenceEx ception: Object reference not set to an instance of a
    object.]
    Gotsap.emphome. Page_Load(Objec t sender, EventArgs e) i
    c:\inetpub\wwwr oot\Gotsap\emph ome.aspx.vb:26
    System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
    System.Web.UI.C ontrol.LoadRecu rsive() +35
    System.Web.UI.P age.ProcessRequ estMain() +731




    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:1.1.432 2.573
    ASP.NET Version:1.1.432 2.573

    What is the error, i am not able to understand.

    Plz help me out.

    Thanks in advance.

    Lalitha.

    --
    lalitha102
    -----------------------------------------------------------------------
    lalitha1024's Profile: http://www.highdots.com/forums/member.php?userid=47
    View this thread: http://www.highdots.com/forums/showthread.php?t=218586

Working...