i get error in login page session

Posted by Suneel161 under Regular Expressions on 2/25/2010 | Views : 1170 | Status : [Member] | Replies : 3
I get an error stating The left-hand side of an assignment must be a variable, property or indexer with the following for statement in C#.



if (dt.Rows.Count != 0)
{
Session("username") = txtusername.Text;
Session("password") = txtpassword.Text;
Response.Redirect("Default2.aspx");
}


plz help me....




Responses

Posted by: Nishithraj on: 2/25/2010 [Member] Bronze

Up
0
Down
Check

http://msdn.microsoft.com/en-us/library/x5s08de8(VS.80).aspx

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Suneel161, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/25/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
First of Session are not Declared like that in ASP.net, use the square Bracket, it will be like its a method. Change it to this


if (dt.Rows.Count != 0)
{
Session["username"] = txtusername.Text;

Session["password"] = txtpassword.Text;

Response.Redirect("Default2.aspx");
}
'

Thank you for Posting at DotnetFunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Suneel161, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 2/25/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Good Day Nishithraj

Please make sure that you read the question correctly before you answer.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Suneel161, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response