Hi,
here is the problem:
1. I've put that source in defaut.aspx.cs and it works just perfect:
Code:
protected void Button1_Click(Object sender,System.EventArgs e)
Code:
{
memUser = Membership.GetUser();
TextBox1.Text = (string)memUser.UserName;
}
2. And when I try to put the source below in default.aspx i recieve err.
Here is the code:
Code:
<form id="form1" runat="server">
<% =(memUser.UserName)%>
</form>
3. I recieve the same err if I put TextBox1.Text = (string)memUser.UserName on the line with TextBox1.Text =.... :
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Page.IsPostBack Then
a1 = 1
Dim userName1 As String = "kalchev"
Dim password As String = "alaba1@"
FormsAuthentication.SetAuthCookie(userName1, False)
memUser = Membership.GetUser
TextBox1.Text = (string)memUser.UserName 'here is the ERR
End If
End Sub
Here is the error:
Object reference not set to an instance of an object.
Any advice is really welcome