Hello,
I'm working an application with asp.net, but I have a problem in session..
I searched a lot about how to kill a session when browser closed but it has not any solution.
Thanks for help.

Session.Clear() has worked fine for me.

You can clear it manually if you know for sure that the browser was closed. How would you know server side that the browser closed?

The session will clear on its own according to the session timeout period. if a user closes their browser and opens it again and accesses your site, a new session is created.

I owe an explanation. I said about Session.Clear() to use it whenever the information stored inside the session variables are not needed any more. In this way you might see that you dont need to worry about the closing of the browser.
@JorgeM is absolutelly corect in all he direct you

but how can I guess the period of session timeout ?
In my application when a user open a page I give him the permission to do something, but when he close the browser I have to clear or remove the session.
But the problem when I close the browser and open again the session doesn't remove.

but how can I guess the period of session timeout ?

The default is 20 min, but you can configure a different timeout value in your web.config file. http://msdn.microsoft.com/en-us/library/h6bb9cz9%28v=vs.80%29.aspx

reduce the session timeout value... also provide the user with a logout button..if clicked abandon the session as tdrosiadis suggested.

just a guess but i think it can be done in global.asax Session_End event. do call same statements as suggested by @tdrosiadis ..... it will clear session if user closes browser without log-out or any action.

Session.Clear() 
Session.Abondan()

try it out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.