Solution in C# which you can understand and translate later...
Instead of Session, you can use a static variable like:
static int recordPerPage = 20;
Then, in Page_Load():
if(Request.QueryString["Page"]!=null)
{
if(Request.QueryString["Page"].ToString()=="2")
recordPerPage = 150;
}
Above mentioned is the main and correct solution for your problem according to me. Still, if you want to clear the Session variable, you can do it easily by:
Session["recordPerPage"] = "";
You have to do this as Session variables do not lose their values on another Page call / Load. This is their main property and that's why they are used. And if you want to clear their value, you have to clear it manually by assigning null or "" value to them.