Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This error is giving when i am using Session["Name"].Abandon();
Compiler Error Message: CS0117: 'object' does not contain a definition for 'Abandon'

Source Error:
Line 993:{
Line 994:FormsAuthentication.SignOut();
Line 995:Session["Name"].Abandon();
Line 996:Response.Redirect("index.aspx");
Line 997:}

My CS CODE FOR LOGOUT IS GIVEN BELOW
C#
void logout(Object Sender, EventArgs e)
{
FormsAuthentication.SignOut();
Session["Name"].Abandon();
Response.Redirect("index.aspx");
}
Posted
Updated 29-Dec-11 21:13pm
v2

Take the indexing out - Session contains the Abandon method, not the indicvidual items...
C#
void logout(Object Sender, EventArgs e)
    {
    FormsAuthentication.SignOut();
    Session.Abandon();
    Response.Redirect("index.aspx");
    }

If you read my answer, that is what I wrote last time...
 
Share this answer
 
Comments
Janardan Pandey 30-Dec-11 3:25am    
but this code is not deactivate back button of index.aspx page.When i press back button of index page of explorer it is again going to previous page.
OriginalGriff 30-Dec-11 3:44am    
No - and it won't.
There is no way to disable the back button - and the page it goes to is held in a cache locally by the browser itself, rather than being loaded fresh from the internet.
There is a discussion on this here: but as he says, it doesn't necessarily work with all browsers!
http://www.4guysfromrolla.com/webtech/111500-1.shtml
Janardan Pandey 30-Dec-11 3:49am    
but what about LogOut?
OriginalGriff 30-Dec-11 3:57am    
That code does the log out - what are you asking about?
Session["Name"].Abandon();
This is WRONG.

'Session' object has 'Abandon' property exposed to it. Individual items do not. I am not sure how you were able to put Abandon after individual reference as Visual Studio would not suggest the same. Try to use the VS auto-intellegense and you will see by yourself what all are exposed and accessible.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900