Click here to Skip to main content
15,889,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear,

I have created data services, below is my login code working fine.

JavaScript
var _url = "http://localhost/CMWeb/DataService.svc/Users?$filter=UserName eq '" + "Basit" + "' and Password eq '" + "s" + "'&$format=json";
            UserAdmin = 0,
            $.ajax({
                type: "GET",
                url: _url,
                timeout: 10000,
                async: false,
                dataType: "json",
                contentType: "application/jsonp; charset=utf-8",
                success: function (data) {

                    debugger;

                    if (data.d.length > 0 && data.d[0].UserEnabled == 1) {
                        UserAdmin = data.d[0].UserAdmin
                    //redirect to main page
                    } else {
                        //show alter message.
                    }
                },
                error: function (xhr, status, error) { 

                }
            });


In Data services DataService.svc

After login i want to get current user
that's why i wrote
XML
<QueryInterceptor("CustomersCalls")> _
Public Function OnQueryOrders() As Expression(Of Func(Of CustomersCall, Boolean))

    'Dim User As System.Security.Principal.IPrincipal
    'User = System.Web.HttpContext.Current.User
    'Dim user = Membership.GetUser(HttpContext.Current.User.Identity.Name)

    Return Function(c) c.CreatedBy = User.Identity.Name
End Function

but i got only computer name, how to get the current user.

Thanks
Basit.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900