using System;
using System.Net;
using System.IO;
using System.Text; [STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
string url="http://localhost/csdn2/1.asp";
// <%
// if request("aa")="zhuye" then session("ok")="ok"
// if session("ok")="ok" then
// response.write("登录")
// else
// response.write("没有登录")
// end if
// %>
string indata="aa=zhuye";
string outdata="";
CookieContainer myCookieContainer=new CookieContainer();
//新建一个CookieContainer来存放Cookie集合
HttpWebRequest myHttpWebRequest=(HttpWebRequest)WebRequest.Create(url);
//新建一个HttpWebRequest
myHttpWebRequest.ContentType="application/x-www-form-urlencoded";
myHttpWebRequest.ContentLength=indata.Length;
myHttpWebRequest.Method="POST";
myHttpWebRequest.CookieContainer=myCookieContainer;
//设置HttpWebRequest的CookieContainer为刚才建立的那个myCookieContainer
Stream myRequestStream=myHttpWebRequest.GetRequestStream();
StreamWriter myStreamWriter=new StreamWriter(myRequestStream,Encoding.GetEncoding("gb2312"));
myStreamWriter.Write(indata);
//把数据写入HttpWebRequest的Request流
myStreamWriter.Close();
myRequestStream.Close();
&nb