Session["UserName"] = txtName.Text.Trim();FormsAuthentication.RedirectFromLoginPage(txtName.Text, false); FormsAuthentication.SetAuthCookie(txtName.Text, false); 麻烦大侠解释下,这三段的意思.

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/06 14:36:26
Session[

Session["UserName"] = txtName.Text.Trim();FormsAuthentication.RedirectFromLoginPage(txtName.Text, false); FormsAuthentication.SetAuthCookie(txtName.Text, false); 麻烦大侠解释下,这三段的意思.
Session["UserName"] = txtName.Text.Trim();
FormsAuthentication.RedirectFromLoginPage(txtName.Text, false);
FormsAuthentication.SetAuthCookie(txtName.Text, false);

麻烦大侠解释下,这三段的意思.

Session["UserName"] = txtName.Text.Trim();FormsAuthentication.RedirectFromLoginPage(txtName.Text, false); FormsAuthentication.SetAuthCookie(txtName.Text, false); 麻烦大侠解释下,这三段的意思.
为Session["UserName"]赋值,即存储用户名,以后在任何页面可以获取用户名Session["UserName"].ToString()
使用 Forms 身份验证 Cookie 的指定 Cookie 路径,将经过身份验证的用户重定向回最初请求的 URL 或默认 URL
为提供的用户名创建一个身份验证票证,并将其添加到响应的 Cookie 集合或 URL
后面两句关于Forms身份验证的,你上MSDN查看一下,更深刻了解