ASP and ASP.net sharing session solution

Source: Internet
Author: User
Tags sessions
asp.net|session| solution in the original ASP program with ASP.net to add functional modules, sharing sessions is a difficult point, the following describes a more concise method, can be in ASP and ASP.net share session sessions.

The login page is recreated using C #, executing the statement after a successful login:

Response.Write ("<script language= ' JavaScript ' >window.open (' aspxtoasp.aspx ', ' new ');</script>");

Open aspxtoasp.aspx page, action set to aspxtoasp.asp, you can post the session value to the ASP page, because it is one-way transmission, do not repeat the action on other pages, after testing, transmission success!



The aspxtoasp.aspx code is as follows:

<script language= "C #" runat= "Server" >



Response.Write ("<form name=t id=t action=aspxtoasp.asp method=post>");



foreach (Object it in session.contents)

{

Response.Write ("<input type=hidden name=" + it.) ToString ());

Response.Write ("value=" + session[it). ToString ()]. ToString () + ">");

}

Response.Write ("</FORM>");

Response.Write ("&LT;SCR" + "ipt>t.submit (); &LT;/SCR" + "ipt>");



</script>



The aspxtoasp.asp code is as follows:

<%

For I=1 to Request.Form.Count

Session (Request.Form.Key (i)) =request.form (i)

Next

Response.End



%>

<script language= "JavaScript" >

Window.close ();

</script>


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.