0
votes

Hi i have a question about Session variables, i want to call in GET via ajax, from my .aspx page, a page .asp that have VB6 code inside, i need to share Session variables between them actually i tried this:

ASPX file

<html>
<head>
<title>let's try Ajax</title>
<script type="text/javascript" src="Scripts/jquery-1.10.2.js"></script>
<script>
    $(document).ready(function () {

        var request = $.ajax({
            url: "/Default.asp",
            type: "GET",
            dataType: "html",
            cache: "false"
        });


        request.done(function(msg){

            $("#insert").html(msg);

        });
    });
</script>

</head>
<body>
<form id="form1" runat="server">
    <div>
        in the aspx: <%Response.Write(Session["try"].ToString()); %>

    </div>
<div id="insert">

</div>
</form>
</body>
</html>

code behind page:

public partial class _Default : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["try"] = "hello world";
    }
}

finally .asp page

<%
  [...]
  Response.Write  "" & Session("try")
  Response.End 
  [...]
%>

Actually the Session doesn't show anything in the .asp page, but in the .aspx page shows it's string inside, what's wrong with my code? Is it possible to pass share a session?

1
Not really sure what you are trying to achieve, I have used VB6 for windows development not sure why you need session value here. If you just want to share values store it in Database and access it from there - Vinay Pandey

1 Answers

2
votes

I think, you want to share your session between Class ASP and ASP.Net. so you need to store your session information in SQL server. Please refer below link

http://msdn.microsoft.com/en-us/library/aa479313.aspx