asp.net传值

input标签传值   <input type="text" id="txtName" name="txtName" runat="server"/>

Request.Form[]接收  string txtName = Request.Form["txtName"].ToString();

 

表单传值     <form name="form1" method="post" action="02.jsp">   你的姓名:<input type="text" name="name">   你的爱好:<input type="text" name="hobby">    </form>

request.getParameter()接收   String name= request.getParameter("name"); String hobby=request.getParameter("hobby");

 

url传值   Default.aspx?param1=1111&param2=2222

Request.QueryString接收值  var userId=Request.QueryString["UserId"]

 

Session传值  Session["name"] = txtName.Value

接收   string name = Session["name"].ToString();

 

Cookie传值    HttpCookie cookie = new HttpCookie("MyCookie", aa); Response.Cookies.Add(cookie)

接收  HttpCookie myCookie = Request.Cookies["MyCookie"]; txt1.Value = myCookie.Value;

 

 

Application传值
Application["count"] = 12;
接收
int count= (int)Application["count"]

posted @ 2017-03-23 14:35  爱生活,爱代码  阅读(190)  评论(0编辑  收藏  举报