日期:2014-05-18 浏览次数:20505 次
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = Request.Cookies["hello"]; if ((cookie != null)) { Label1.Text = cookie.Value; TextBox1.Text = cookie.Value; //Response.ContentType = "text/HTML"; Response.Write(cookie.Value); Response.End(); } else { Response.Write("no Cookie"); Response.End(); } }
<script language="JavaScript"> var xmlHttp ; function createXMLHttpRequest() { if(window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } else if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } } function doPostBack() { var url = "http://www.aaa.com/test1.aspx"; createXMLHttpRequest() ; xmlHttp.open("GET",url,true); xmlHttp.onReadyStatechange = showCallBack; xmlHttp.send(null); } //回调函数 function showCallBack() { if(xmlHttp.readyState==4) { if(xmlHttp.status==200) { success(); } } } //解析xml function success() { var responseXml; responseXml = xmlHttp.responseXML; var text= xmlHttp.responseText; if(text!=null&&text.length>0) { alert(text); } else { info = xmlHttp.responseText; alert(info); } } </script>