Recently, I was working on integrating an Asp.net (1.1) system (system A) with an old ASP system (system B). Using the same database, I have some experience in integration. Here we will record it for your reference.
The key here is the session. The session in. Net cannot be shared with the session in ASP (the same is true for applications ). System A and system B have database connection strings (both Application variables) and user IDs (both session variables ). How can we use the database connection string of system A in system B? First, the database connection string and user ID are retrieved in Asp.net and stored in the <input type = "hidden"> Field of the client, and then transmitted to the traditional ASP page, here, we can extract the required variable values and send them to the session variables of ASP for use on the ASP page. So that Asp.net and traditional ASP systems can coexist.
<% @ Page Language = "C #" codebehind = "Redirect. aspx. cs" autoeventwireup = "false" %>
<Input type = hidden name = "userid" value = "<% = session [" userid "]. tostring () %>">
<Input type = hidden name = "flag" value = "<% = request [" flag "]. tostring () %>">
<Input type = hidden name = "strconnection" value = "<% = application [" udlfilepath "]. tostring () %>">
<Script language = JavaScript>
<! --
If (document. All. Flag. value = "1 ")
Window. Location. Replace ("bbs_shorttop.asp? Userid = "+ document. All. userid. Value +" & connection = "+ document. All. strconnection. value );
Else if (document. All. Flag. value = "2 ")
{
Window. Location. Replace ("bbs_companydesktop.asp? Userid = "+ document. All. userid. Value +" & connection = "+ document. All. strconnection. value );
}
Else if (document. All. Flag. value = "3 ")
Window. Location. Replace ("bbs_topten.asp? Userid = "+ document. All. userid. Value +" & connection = "+ document. All. strconnection. value );
Else if (document. All. Flag. value = "4 ")
Window. Location. Replace ("bbs_colmanageframe.asp? C = 001009 & userid = "+ document. All. userid. Value +" & connection = "+ document. All. strconnection. value );
// -->
</SCRIPT>
This code is the middle layer connecting two systems