'Classic ASP: Session values fail to pass over to popup window

I'm trying to pass values through session from one page to a popup window. But it fail to pass the value. I checked the ISS where Enable Session State is true. I will post the code which I'm working please let me know something I'm missing in it or any other variable settings problem like php.ini

<script language="javascript" type="text/javascript">
function veh(url) {
        popupWindow = window.open(url, 'popUpWindow', 'height=300,width=300,left=50,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');
    }
</script>

<%
' Define to hold temporary super session  
 Dim strManu  // Manufacture type
 strManu = Session("Manu")
 Dim objRS
 Dim strSQL  
 Dim strVeh
  
  Set objRS=Server.CreateObject ("ADODB.Recordset")
  strSQL="SELECT vl.* FROM veh_tbl vl where vl.manuID= " & strManu  
  objRS.Open strSQL,objconn
  if not objRS.eof then 
     strVeh=objRS("veh")
     Session("Veh")=strVeh
  end if
  objRS.Close
  Set objRS=Nothing  

 <a href='http://www.example.com/popup.asp' target='_self' 
 onclick='veh(this.href);return false'><img border='0'src='images/info.jpg'></a> 

Popup window


<% 
 Dim strVal
 strVal = Session("Veh")
%>
<FORM name=MyForm>
 <%     Response.Write "<label class = 'col-sm-4 col-form-label'>" & strVal & "</label>"     %>
</FORM>     
%>                                

I'm getting the value from the DB and I'm able to print the string(strVeh) in the same page. I'm not able to pass the same in pop window. It fails to show any error. Anyone please help me to address the issue.



Solution 1:[1]

Things I would check:

  1. First, in href='http://www.example.com/popup.asp' does the domain and subdomain match the source page exactly? For example adding or removing the "www" may make a difference.
  2. Are you positive if not objRS.eof then is resolving true? For example try just putting session("test") = "test" somewhere on the page outside of a conditional statement and see if that variable is available in the popup.

Solution 2:[2]

Had this issue recently, if I typed in 'https://www.myweb.com/checksession.asp' it would not load/could not see the session variables.

Type in 'https://myweb.com/checksession.asp' (i.e. remove the www.) and it works fine.

So something to bear in mind if referencing from another page/ajax/loading scripts etc.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jacob M.
Solution 2 Yunnosch