?????????ASP.NET?????????????????????????????????????????????????????????????????????????????磬???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????к????????磬??????????<a>???????????href????????? windows.location ???????????????????????????????????????????????????????????????
?????????????
??????? -> ??? Asp.Net Web ??ó??? -> Empty -> ???? PassValueDemo
???????????? -> Web???? -> SourcePage.aspx??????-> ???????Web???? -> TargetPage.aspx????????

??????????????VS2013?????????
?????????????
????Response.Redirect ????????????????????μ? URL??
?????????URL ??????·?????? http://www.baidu.com">http://www.baidu.com ??????????·?????? TargetPage.aspx ?????Щ???????????????·??
????//?? SourcePage.aspx ?????????????????????? TargetPage.aspx
????Response.Redirect("TargetPage.aspx");
????//?? SourcePage.aspx ????????URL???
????Response.Redirect("http://www.baidu.com");
????Server.Transfer ???????????????????У???????????? URL ·??????????????????
?????????1. URL ???????????????????????????????? http://www.baidu.com ???
????2. ASP.NET ??д??????????????????????з??? URL ????????????????????????????? Response.Redirect ?? WindowsPrincipal.IsInRole ????
????3. ??????????????е? URL ??????????????????? URL

????//??????? SourcePage.aspx ????з?????????????? TargetPage.aspx
????Server.Transfer("TargetPage.aspx");
?????????????
????1. ??ò???????

????HttpRequest.QueryString ?????NameValueCollection ?????
???????????????????????????????????????"fullname"??????????????????
?????????????У???? URL ?? http://localhost:49495/Target.aspx?fullname=Fadi%20Fakhouri ?????????"Fadi Fakhouri"????? %20 ?? URL ????????????????????? URL ?????? fullname ???????? ID??????????? null??
????????д????????????????????е?"fullname"??????в??????"fullname"?е????? HTTP ?????????
????//?? QueryString ?л??????????
????string fullname1 = Request.QueryString["fullname"];
????//?? QueryString??Form??Cookies ?? ServerVariables ??????????????
????string fullname2 = Request["fullname"];
????2. ??????
????2.1 HttpCookie ??

?????????????? Cookie ??????? HttpCookieCollection ?????洢????????????? Cookie ???????
????ASP.NET ??????????? Cookie ???????? HttpRequest ????? Cookies ?????????????????? Cookie ??????????????????????? Cookie????? HttpResponse ????? Cookies ???????????????Щ?? Cookie????Щ Cookie ???????????????? Set-Cookie HTTP ?????????????????????
?????????????????????????ζ? HttpRequest ????????? DateCookieExample ?? Cookie ???м?顣
?????????????? Cookie???????????????????? HttpResponse ????Cookie ????? 10 ?????????
<%@ Page Language="C#" %>
<!DOCTYPE html>
<body>
<form id="form1" runat="server">
<asp:Label ID="labCookie" runat="server"></asp:Label>
</form>
<script runat="server">
protected void Page_Load(object sender?? EventArgs e)
{
StringBuilder sb = new StringBuilder();
// ???????? HttpRequest ?л?? Cookie
HttpCookie cookie = Request.Cookies.Get("DateCookieExample");
// ??鵱????????????? Cookie
if (cookie == null)
{
sb.Append("δ?????????? Cookie ");
sb.Append("??????? Cookie ?????????????? http ?????????<br/>");
// ???? Cookie
cookie = new HttpCookie("DateCookieExample");
// ?? Cookie ??????????????
cookie.Value = DateTime.Now.ToString();
// ???? Cookie ?????????10????
cookie.Expires = DateTime.Now.AddMinutes(10d);
// ?? Cookie ?????????http??? HttpResponse ??
Response.Cookies.Add(cookie);
}
else
{
sb.Append("???????????? Cookie <br/>");
sb.Append("Cookie ????: " + cookie.Name + "<br/>");
sb.Append("Cookie ?: " + cookie.Value + "<br/>");
sb.Append("Cookie ???????: " + cookie.Expires.ToString() + "<br/>");
}
labCookie.Text = sb.ToString();
}
</script>
</body>
????2.2 Page.Session ?????HttpSessionState ?????
?????????????й??????????????????? ASP.NET ??ó??????????????????????????? Session ?????????????ó????д????????????????洢?? Session ?????е???????????????????????????ó????з????????Щ???????????
?????й????????????????μ? ASP.NET Session State Overview??
????Session["Name"] = tbName.Text;
????Session["Email"] = tbEmail.Text;
????2.3 Page.Application ?????HttpApplicationState ?????
????ASP.NET ??ó???????? Web ????????????????????????????Χ??????????????????????????????????
????HttpApplicationState ??????????????????δ????????? ASP.NET ??ó????????????????κ? URL ?????????????? Web ???????????? ASP.NET ??ó??????????????????????????????? Application ???????????????????á?
??????ó????????????糡????ó????????????????????????????ó?????????????????????????й????
????Application.Lock();
????tbName.Text = Application["Name"];
????Application.UnLock();