Request.Params 用法简例

前台页面:

<a href='?add=<%# Eval("UserID") %> ' onclick="return Confi()" id="addhref"></a>

后台Page_Load方法中:

if (!string.IsNullOrEmpty(Request.Params["add"])) //添加好友

        {

            string ID = Convert.ToString(Request.Params["add"]);

            try

            {

                if (!sc.AddFriends(FoundationMethod.GetUserByCookieName("user"), ID))

                {

                    Response.Write("<script>alert('添加成功');</script>");

                }

                else

                {

                    Response.Write("<script>alert('添加失败');</script>");

                }

            }

            catch { Response.Write("<script>alert('添加失败');</script>"); }

        }

你可能感兴趣的:(request)