现在我改进一个系统,原来这个系统是由asp编写的,系统比较大,所以我先更改一部分的asp页面为asp.net,现在遇到问题了。
我需要在新的asp.net页面处理完毕后,再把数据收集起来再交给旧的asp页面处理,这样才能保证系统的数据一致性,即是form里面的数据要进行二次处理,我在新的asp.net页面后台获取前台的数据处理完毕后,我再要提交给旧的asp页面,这个问题怎么解决?可以在后台的c#代码里面调用旧的asp页面处理吗?关键是form里面的参数怎么传递给旧的asp页面,新的asp.net页面的前台的input的name和旧的是不同的。
谢谢!

解决方案 »

  1.   

    you can use querystring to redirect your URL
      

  2.   

    http://dotnet.aspx.cc/ShowDetail.aspx?id=ATV1GLXT-65FF-4M82-CT5U-B1J65D3ZN2OK
      

  3.   

    试试这样:
    string strjs = "<script>window.open('*.asp?var="+var;
    strjs +="',null,'";
    strjs +=");</script>";Response.Write (strjs);
      

  4.   

    不能用querystring,因为他旧的asp页面是用Request直接得到的,新的input的name又和旧的不同。下面是旧asp片断:
    idx=Request("id")
    a1=Request("a1")
    a2=Request("a2")
    a3=Request("a3")
    a4=Request("a4")
    a5=Request("a5")
    a6=Request("a6")
    a7=Request("a7")
    a8=Request("a8")
    .....
      

  5.   

    问题得到解决,下面是C#代码,参照 (孟子E章) :string postData = "aa=0987650987654321";
    string strUrl = "http://localhost/ffok/11.asp";
    byte[] data = System.Text.Encoding.ASCII.GetBytes(postData);
    HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(strUrl);
    myRequest.Method = "POST";
    myRequest.ContentType="application/x-www-form-urlencoded";
    myRequest.ContentLength = data.Length; Stream newStream=myRequest.GetRequestStream();
    newStream.Write(data,0,data.Length);
    newStream.Close();响应的asp网页代码:
    <%
    db_path = "ffok.mdb"
    Set conn= Server.CreateObject("ADODB.Connection")
    connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath(db_path)
    conn.Open connstr
    Set rs = Server.CreateObject ("ADODB.Recordset")
    dim aa
    aa = Request("aa") + "11"
    sql = "Select * from ab"
    rs.Open sql,conn,3,2
    rs.addnew
    rs("a")=aa
    rs("b")="asdf"
    rs.update
    rs.Close
    %>在11.asp下建一个access数据库,建一个表ab,里面有两个字段a和b
    自己测试下吧。附加msdn的一段代码:(关于ContentType)
    // Set the 'Method' property of the 'Webrequest' to 'POST'.
    myHttpWebRequest.Method="POST";
    Console.WriteLine("\nPlease enter the data to be posted to the (http://www.contoso.com/codesnippets/next.asp) Uri :");
    // Create a new string object to POST data to the Url.
    string inputData=Console.ReadLine();
    string postData="firstone="+inputData;
    ASCIIEncoding encoding=new ASCIIEncoding();
    byte[]  byte1=encoding.GetBytes(postData);
    // Set the content type of the data being posted.
    myHttpWebRequest.ContentType="application/x-www-form-urlencoded";
    // Set the content length of the string being posted.
    myHttpWebRequest.ContentLength=postData.Length;
    Stream newStream=myHttpWebRequest.GetRequestStream();
    newStream.Write(byte1,0,byte1.Length);
    Console.WriteLine("The value of 'ContentLength' property after sending the data is {0}",myHttpWebRequest.ContentLength);
    // Close the Stream object.
    newStream.Close();