954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Remove session variable in web handler

Hi all

I have declared a Session variable in web handler i-e .ashx file like below

int SaleID;
  HttpContext.Current.Session["tempSaleID"] = SaleID;


Now i want to remove this Session variable in class file i-e .cs

In normal cases Session variable are removed using

Session.Remove("SaleID");


but in this case its not working because its declared in web handler.

Kindly tell me how can i remove this?

fawadkhalil
Junior Poster in Training
88 posts since Dec 2008
Reputation Points: 10
Solved Threads: 2
 

if u wanted to destroy the session then u can write the code like.
session["sessioid"]="";
your session will automatically destroied.

narendrajarad
Newbie Poster
4 posts since Jan 2012
Reputation Points: 10
Solved Threads: 0
 

How can i get Sessionid

fawadkhalil
Junior Poster in Training
88 posts since Dec 2008
Reputation Points: 10
Solved Threads: 2
 

SessionID is your session name

kamilacbe
Junior Poster in Training
77 posts since Jun 2010
Reputation Points: 10
Solved Threads: 10
 

use session.abandon() method will destroy your session

mani-hellboy
Junior Poster in Training
69 posts since Feb 2012
Reputation Points: 0
Solved Threads: 7
 

seems like you are removing the wrong session name. your session name in the web handler is tempSaleID and what you are trying to remove is SaleID

Cruize_Invades
Light Poster
40 posts since May 2007
Reputation Points: 6
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You