首页 > 其他 > 详细

弗尤博客(二)

时间:2018-12-07 19:34:50      阅读:145      评论:0      收藏:0      [点我收藏+]

今天实现游客和注册用户登录

技术分享图片
 1 using System.Collections.Generic;
 2 using System.Linq;
 3 using System.Web;
 4 using System.Web.UI;
 5 using System.Web.UI.WebControls;
 6 using System.Data;
 7 using Business;
 8 using Entity;
 9 public partial class Main : System.Web.UI.MasterPage
10 {
11     protected void Page_Load(object sender, EventArgs e)
12     {
13         if (Session["uid"] == null)
14         {
15             Label1.Text = "游客";
16             lb_blogs.Text = "";
17             lb_log.Text = "登录";
18             lb_logoff.Text = "";
19             lb_registe.Text = "注册";
20         }
21         else
22         {
23             UserBusiness uname = new UserBusiness();
24             UserEntity user = new UserEntity();
25             user.Uid= Session["uid"].ToString();
26             DataTable dt = new DataTable();
27             dt = uname.FindUserInfo(user);
28             DataList1.DataSource=dt;
29             DataList1.DataBind();
30             Label1.Text = "";
31             lb_blogs.Text = "我的博客";
32             lb_log.Text = "";
33             lb_logoff.Text = "退出";
34             lb_registe.Text = "";
35         }
36     }
37 
38     protected void lb_log_Click(object sender, EventArgs e)
39     {
40         Response.Redirect("UserLogin.aspx");
41     }
42 }
View Code

 

技术分享图片技术分享图片

弗尤博客(二)

原文:https://www.cnblogs.com/frankybpx/p/10084202.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!