Allow public usage of WebService DNN API

102 views Asked by At

I have some webservices which only logged on users can use. However, I need one to allow public access and to non-registered members to use as well.

I have given my DNN module permissions to be viewed by Unauthorized and All users and my webmethod as such:

   <HttpGet>
    Public Function FindSomeone(q As String) As HttpResponseMessage
        Try
            Return Request.CreateResponse(HttpStatusCode.OK, "ok".ToJson)

        Catch exc As Exception
            Return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, exc)
        End Try
    End Function

I have tried adding:

<DnnModuleAuthorize(AccessLevel:=SecurityAccessLevel.View)>

and

 <DnnModuleAuthorize(AccessLevel:=SecurityAccessLevel.Anonymous)>

but it still doesn't work for users who are not logged on.

Any ideas?

1

There are 1 answers

0
Fix It Scotty On BEST ANSWER

To make the services completely open, add the <AllowAnonymous> attribute.