Session not allow in ASP.Net Mobile Web App?

Discussion in 'ASP .Net Mobile' started by Pop, Dec 4, 2004.

  1. Pop

    Pop Guest

    Hi alls,
    I'm writing a asp.net mobile web app.
    Here are the codes:
    try
    {
    myConn.Open();
    myCmd.Connection=myConn;
    myCmd.CommandText = strSelect;
    myReader = myCmd.ExecuteReader();
    myReader.Read();
    if ( myReader.HasRows)
    {
    Session("StaffID") = myReader.GetValue(0);
    Session("Login") = true;
    Response.Redirect("MainMenu.aspx",false);
    }//end if
    else
    {
    Response.Redirect("LoginFail.aspx",false);
    }//end else
    }//end try

    it return me an error message like this:
    'System.Web.UI.Page.Session' denotes a 'property' where a 'method' was
    expected
    This is the only error I get.
    Is it something wrong with my syntax or what??

    Thanks in advance.
    Best regards,
    Pop
     
    Pop, Dec 4, 2004
    #1
    1. Advertising

  2. Pop

    JuanDG Guest

    It looks you either come from VB or Copied this code from a VB article,
    because in C# you put the name of the session variable in brackets, not in
    parenthesis like in VB, something like this:

    Session["Login"]= true;

    Cheers!!!!!

    --

    Juan David Gomez A.
    Microsoft Certified Professional
    Analista de Desarrollo - PSL S.A.
    Web and Wireless Banking
    Medellin - Colombia

    "Pop" <> wrote in message
    news:...
    > Hi alls,
    > I'm writing a asp.net mobile web app.
    > Here are the codes:
    > try
    > {
    > myConn.Open();
    > myCmd.Connection=myConn;
    > myCmd.CommandText = strSelect;
    > myReader = myCmd.ExecuteReader();
    > myReader.Read();
    > if ( myReader.HasRows)
    > {
    > Session("StaffID") = myReader.GetValue(0);
    > Session("Login") = true;
    > Response.Redirect("MainMenu.aspx",false);
    > }//end if
    > else
    > {
    > Response.Redirect("LoginFail.aspx",false);
    > }//end else
    > }//end try
    >
    > it return me an error message like this:
    > 'System.Web.UI.Page.Session' denotes a 'property' where a 'method' was
    > expected
    > This is the only error I get.
    > Is it something wrong with my syntax or what??
    >
    > Thanks in advance.
    > Best regards,
    > Pop
     
    JuanDG, Dec 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rico
    Replies:
    0
    Views:
    419
  2. Jeff
    Replies:
    2
    Views:
    986
    clintonG
    Sep 19, 2006
  3. chen selina
    Replies:
    0
    Views:
    1,392
    chen selina
    Jul 13, 2010
  4. Rico
    Replies:
    1
    Views:
    321
  5. Ryan Taylor
    Replies:
    1
    Views:
    717
    Ryan Taylor
    Sep 9, 2004
Loading...

Share This Page