现在我想跳转到一个页面,并把一些参数传递过去,一般想到的就是用get方式,在地址后面把参数加上,但是目前我的涉及到比较重要的数据,我不想用这样的方式,不安全,而且我的参数有可能会有很多数据,如果数据太大的话,可能传递失败,.net中默认是post到本页面中,现在我在一个按上的事件中想实现跳转到另一个页面中,并且把一些参数传过去,要如何实现?当然这个按钮的事件中我还会处理很多的逻辑代码,请高人帮助,寻求除了用session及cookie以外的方法,因为session不注意就过时,设置session又不太好,看起来要求有一点过分哈,嘿嘿,有没有什么变通的方法?

解决方案 »

  1.   

    postbackurl,这个可以。
    但是对性能的影响不清楚,有经验的朋友给说说吧。
      

  2.   

    post不太好处理,因为按钮的事件中还要处理好多逻辑,我不知道在按钮的事件中如何来写一个post?就算是post以后页面可能不会转到目标页面中去
      

  3.   

    using System.Net;
    using System.Collections.Specialized;
    ....
    public string getPostBackStream(string rUrl)
    {
    // Create a new WebClient instance.
    WebClient myWebClient = new WebClient();
    // Create a new NameValueCollection instance to hold
    // some custom parameters to be posted to the URL.
    NameValueCollection myNameValueCollection = new NameValueCollection();
    myNameValueCollection.Add("title","this is title"); myNameValueCollection.Add("excerpt","this is excerpt");
    byte[] responseArray = myWebClient.UploadValues(rUrl,"POST",myNameValueCollection);
    return Encoding.ASCII.GetString(responseArray);
    }WebClient post到页面,并且返回页面的结果。