Session not allow in ASP.Net Mobile Web App?

P

Pop

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
 
J

JuanDG

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top