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?

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

How can i get Sessionid

SessionID is your session name

use session.abandon() method will destroy your session

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

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.