profile中的个性化设置保存不了?
其他的都正常,就是单击保存的时候profile相应项没有保存!Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load--------------------编程问答-------------------- 原来page_load先于button的click事件
If Page.User.Identity.IsAuthenticated Then
Response.Write(Page.User.Identity.Name)
txtname.Text = Profile.dearname
txtplace.Text = Profile.place
txtblog.Text = Profile.blog
txtintro.Text = Profile.intro
Else
Response.Write("请先登陆!")
End If
End Sub
Protected Sub btnupdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnupdate.Click
If Page.User.Identity.IsAuthenticated Then
Profile.dearname = txtname.Text
Profile.place = txtplace.Text
Profile.blog = txtblog.Text
Profile.intro = txtintro.Text
Response.Write("恭喜,更新成功!")
Else
Response.Write("请先登录!")
End If
End Sub
所以要加上ispostback判断一下,如果是回发,就不管了,而是直接处理btnupdate_click,否则,取不到textbox中的值了!
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load--------------------编程问答-------------------- 建议不要用membership自带的profile
If Not Page.IsPostBack Then
If Page.User.Identity.IsAuthenticated Then
Response.Write(Page.User.Identity.Name)
txtname.Text = Profile.dearname
txtplace.Text = Profile.place
txtblog.Text = Profile.blog
txtintro.Text = Profile.intro
Else
Response.Write("请先登陆!")
End If
End If
End Sub
网上有很多实现 用mysql sqlserver 文件 来保存用户的profile
是扩展微软的 --------------------编程问答--------------------
补充:.NET技术 , ASP.NET