Hi,
I create a asp.net 2.0 website and a lot of page include a login page. I convert the login control to template because i want to add a dropdownlist which poses some value which is needed like schoolID. The login page is work fine, but what i need is when user authenticated, I want to store some value to the profile. Like SchoolID, Role, and UserID. So I add the code below to the login page.
Login.aspx.vb
Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If User.Identity.IsAuthenticated Then
If User.IsInRole("admin") Then
Dim ddlSchoolID As DropDownList = Me.LoginView1.FindControl("ddlSchoolID")
Dim UserName As TextBox = Me.LoginView1.FindControl("UserName")
Profile.SchoolID = ddlSchoolID.SelectedValue
Profile.UserID = UserName.Text
Profile.Role = "admin" End If
End If
End Sub
Web.config
<anonymousIdentification enabled="true"/>
<profile>
<properties>
<add name="SchoolID" defaultValue="ABC01" allowAnonymous="true"/>
<add name="UserID" defaultValue="A0001" allowAnonymous="true"/>
<add name="Role" defaultValue="user" allowAnonymous="true"/>
</properties>
</profile>
Because I need to use the Profile value when user logon (like use the value to create dynamic menu and so on. All the page is running, just cannot get the value from profile only. It always get the default value in web.config. I believe it must be something wrong in the login button event.
Hope someone can help on this. Thank you.
*Is anyone have some reference regarding popup calendar in gridview in editmode
Calvin
I create a asp.net 2.0 website and a lot of page include a login page. I convert the login control to template because i want to add a dropdownlist which poses some value which is needed like schoolID. The login page is work fine, but what i need is when user authenticated, I want to store some value to the profile. Like SchoolID, Role, and UserID. So I add the code below to the login page.
Login.aspx.vb
Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If User.Identity.IsAuthenticated Then
If User.IsInRole("admin") Then
Dim ddlSchoolID As DropDownList = Me.LoginView1.FindControl("ddlSchoolID")
Dim UserName As TextBox = Me.LoginView1.FindControl("UserName")
Profile.SchoolID = ddlSchoolID.SelectedValue
Profile.UserID = UserName.Text
Profile.Role = "admin" End If
End If
End Sub
Web.config
<anonymousIdentification enabled="true"/>
<profile>
<properties>
<add name="SchoolID" defaultValue="ABC01" allowAnonymous="true"/>
<add name="UserID" defaultValue="A0001" allowAnonymous="true"/>
<add name="Role" defaultValue="user" allowAnonymous="true"/>
</properties>
</profile>
Because I need to use the Profile value when user logon (like use the value to create dynamic menu and so on. All the page is running, just cannot get the value from profile only. It always get the default value in web.config. I believe it must be something wrong in the login button event.
Hope someone can help on this. Thank you.
*Is anyone have some reference regarding popup calendar in gridview in editmode
Calvin