1

What i'm trying to do is to test if a role is affected to a user or not, the method (fig 1 ) which test is exposed with WCF Data Service, and i'm trying to call it (fig 2 ) from the client side. the call is correct because i tested a simple test which returns and i got what i want it to send but when i change the body of the method to send me wheter the user is in a role or not, it thows an exception ( dataservicequeryexception )

fig1:

    [WebGet]
    public bool Controler(string role, string user)
    {

       if(Roles.IsUserInRole(user,role))
        { return true; }

            return false; 
    }

fig2:

      Uri u = new Uri(string.Format(LogIn.ctx.BaseUri + "/Controler?role='{0}'&user='{1}'",
        "Serveur","Oussama"), UriKind.RelativeOrAbsolute);

        IEnumerable<bool> result = LogIn.ctx.Execute<bool>(u);
        bool res = result.Single();

        if (res == true)
        {
            Response.Redirect("Index.aspx");
        }

        else
        {
            Response.Redirect("Error.aspx");
        }

thanks everyone !

Soufiane N
  • 113
  • 1
  • 11

0 Answers0