ASP and Asp.net shared session Solution

Source: Internet
Author: User

Adding function modules with Asp.net in the original ASP program makes sharing sessions a difficult issue. The following describes a simple method to share session sessions in ASP and Asp.net.

Log on to the page and use C # to recreate it. After Successful Logon, run the following statement:

Response. Write ("<script language = 'javascript '> window. Open ('aspxtoasp. aspx', 'new'); </SCRIPT> ");

Open aspxtoasp. on the ASPX page, set action to aspxtoasp. ASP, you can post the session value to the ASP page. Because it is one-way transmission, you do not need to repeat the action on other pages. After testing, the transfer is successful!

 

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 ("<SCR" + "ept> T. Submit (); </scr" + "ept> ");

 

</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>

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.