[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

Session not allow in ASP.Net Mobile Web App?

Pop

12/4/2004 5:15:00 AM

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
1 Answer

JuanDG

12/5/2004 5:17:00 PM

0

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" <Pop@discussions.microsoft.com> wrote in message
news:FD89795C-596D-4B0C-B176-C4DCBB1C9026@microsoft.com...
> 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