locked
Business Application Role Access RRS feed

  • Question

  • Hello,

    i've created a Silverlight Business Application and i'm using the Asp.Net Authentication and MS SQL 2008 R2.

    I've added some Database Fields to the aspnet Roles Table to specifiy the access on my silverlight pages.

    At each opening of an silverlight page, i want to check if the user is allowed to view this page.

    My Code looks like this:



    if (WebContext.Current.Authentication.User.Identity.IsAuthenticated)
                {
                    _AccContext.Load(_AccContext.GetAspnet_RolesQuery().Where(e => e.ReadTickets == 1));
                    if (_AccContext.aspnet_Roles.Count >= 1))
                    {
                        InitializeComponent();
                        _TicketContext.Load(_TicketContext.GetOpenTicketsQuery(), AfterLoad, true);
                    }
                    else
                    {
                        ChildWindow cwPermissionDeny = new ChildWindow();
                        cwPermissionDeny.Title = "No Access!";
                        cwPermissionDeny.Content = "Your not in the right role!";
                        cwPermissionDeny.Show();
                    }
                }

    I've checked the SQL Request with AnjLab, the request is successful but the request arrives at the database after the OnNavigateTo() Method, but my request is in the constructor, so the Context is empty and i always got zero results.

    But the database gives out the right data.

    Could someone tell me what iam doing wrong or how i do it on a better way?

    Wednesday, June 15, 2011 9:20 AM

Answers

  • Problem solved. I forgot the callback method.

    Wednesday, June 22, 2011 10:28 AM

All replies