asp.net学习Request和Response的其他属性

//Request
using System;

using System.Collections;

using System.Configuration;

using System.Data;

//using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

//using System.Xml.Linq;



public partial class ResponseOutput : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        Response.Clear();

        Response.Write("清空前的数据");

        for (int i = 0; i < 4; i++)

        {

            Response.Clear();

            Response.Write("我爱北京天安门~~" + i.ToString());

            //立刻输出缓存

            if (i >= 2)

            {

                Response.Flush();

            }

            System.Threading.Thread.Sleep(1000);

        }

    }

}


//Response

using System;

using System.Collections;

using System.Configuration;

using System.Data;

//using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

//using System.Xml.Linq;



public partial class Reg : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        if (Request.UrlReferrer != null)

        {

            //获取上一次页面地址

            string refferUri = Request.UrlReferrer.ToString();

            if (refferUri.IndexOf("google.com.hk") > -1)

            {

                //如果你上次方位的页面包含我们网站的域名的话,则代表不是盗链

            }

            else

            {

            }

            Response.Write(refferUri);

            //通过套接字拿到访问服务器的IP地址

            Response.Write(Request.UserHostAddress);

        }

    }

}


 

 

 

你可能感兴趣的:(response)