弗尤博客(二)

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

 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值