我仍然一遍又一遍地绊倒这个页面。只是无法让用户的用户名(使用电子邮件作为用户名)mysupport.aspx
在她成功登录后显示在页面上。结果应该看起来像这样,电子邮件显示但它没有检索任何内容:
电子邮件: barb@hotmail.com
作为一个业余爱好者,我知道我错过了一大块拼图,但我不知道是什么。我是否错误地使用了mailLBL.Text = User.Identity.Name.ToString()?下面是代码隐藏:
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data.SqlClient
Partial Class mysupport
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim sConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("TrackTicketsConnectionString2").ConnectionString)
sConnection.Open()
Dim cmdS As String = "Select Email from Users Where Deleted='N'"
Dim cmdCheckmail As New SqlCommand(cmdS, sConnection)
If Session("Ticket") IsNot Nothing Then
mailLBL.Text = User.Identity.Name.ToString()
Else
Response.Redirect("SignIn.aspx")
End If
End Sub
Protected Sub signinBTN_Click(ByVal sender As Object, ByVal e As EventArgs)
Session("Ticket") = Nothing
Response.Redirect("SignIn.aspx")
End Sub
End Class
任何帮助和指导都非常感谢!