You should do it like this
if(!Page.IsPostBack)
{
if(Request.QueryString["userid"] == null || Request.QueryString["userid"] == "")
{
UserID=Session["userid"].ToString();
if(Request.QueryString["userid"] == null || Request.QueryString["userid"] == "")
{
BranchID=Session["branchid"].ToString();
}
}
}
Above is the c# code, use the same logic in VB,net with correct syntax....
What's the problem : Whenever you login the page is first loaded, sets up the querystring value to the session.
But whenever a postback occur your codes assign querystring value to session which is empty now, fill ups the session again with the empty string.
So in above code I have checked and sets the session only once and next time a postback or full pageload occurs, if their is nothing in querystring it simply ignores the assignment.
Hope it helps ........ :)