Hi,
I have the sitemap file with role attached like the following.
And I have also enabled security trimming on sitemap provider.
I handle my login authentication with Application_AuthenticateRequest event (refer code attached).
User login is handled by my own class, macthing to my own user table.
After a successful login from a user (with role properly assigned), the menu didn't hide what it supposed to.
User with "CS" role still can see the rest. When I checked, it displayed correctly current user roles, name.
Authorization is also work well, user can't access to folder where their role is not there. I did not use Role Manager in my case.
Is the Menu Adapater Beta 3 compatible with Security Trimming features ? Or I did it wrong somewhere.
<
siteMapNode title="Customer Service" url="~/CS/default.aspx" roles="CS">
<
siteMapNode title="Spreadsheet" url="~/CS/1.aspx"/>
<
siteMapNode title="Word Processor" url="~/CS/2.aspx"/>
<
siteMapNode title="Games" url="~/CS/3.aspx"/>
</
siteMapNode>
<
siteMapNode title="MDS" url="~/MDS/default.aspx" roles="MDS">
<
siteMapNode title="Programming" url="~/MDS/1.aspx"/>
<
siteMapNode title="Web Apps" url="~/MDS/2.aspx"/>
<
siteMapNode title="WinForm Apps" url="~/MDS/3.aspx"/>
</
siteMapNode>
<
siteMapNode title="Sales Office" url="~/SO/default.aspx" roles="SO,ALL">
<
siteMapNode title="Processes" url="~/SO/1.aspx"/>
<
siteMapNode title="Management" url="~/SO/2.aspx"/>
<
siteMapNode title="Recruiting" url="~/SO/3.aspx"/>
</
siteMapNode>
Global_asax:
Protected Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
If Not HttpContext.Current.User Is Nothing Then
If HttpContext.Current.User.Identity.IsAuthenticated Then
If TypeOf HttpContext.Current.User.Identity Is FormsIdentity Then
Dim Id As FormsIdentity
Id =
CType(HttpContext.Current.User.Identity, FormsIdentity)
Dim ticket As FormsAuthenticationTicket = id.Ticket
' Get the stored user-data, in this case, our roles
Dim userData As String = ticket.UserData
Dim roles() As String = userData.Split(","c)
HttpContext.Current.User =
New GenericPrincipal(id, roles)
End If
End If
End If
End Sub