0

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 Commented Dec 20, 2013 at 8:48

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

3 Comments

This is the only way to share session?
@theLaw In your case, you are calling asp page through Ajax otherwise you can collection all session variable information and crate hidden variables to POST those to Class ASP and do the reverse means create session variable from hidden variable on Classic ASP
@ManojMevada +1 for good explanation .. just an advice dont put only links .. put some ref code too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.