I want to pass \'#\' to the query string like ?page.aspx?someParam=1234#5.
?page.aspx?someParam=1234#5
Try using %23. This is the url encoded value for #.
%23
#