Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDNN WebAPI not working as expectedDNN WebAPI not working as expected
Previous
 
Next
New Post
9/12/2016 4:40 AM
 
We are implementing a WebAPI using DNN (not sure if it's still called Service Framework or if that was the old MVC version). We are having some problems with authentication though.

Something like this seem to work with the current user having correct permissions (being a member of the group):

[DnnAuthorize(StaticRoles = "TheRole")]
[HttpGet()]
public HttpResponseMessage Test()


So authentication and WebAPI in general should be working.

However, this does not work:

[DnnModuleAuthorize(AccessLevel = DotNetNuke.Security.SecurityAccessLevel.Host)]
[HttpGet()]
public HttpResponseMessage Test()

[DnnModuleAuthorize(AccessLevel = DotNetNuke.Security.SecurityAccessLevel.Admin)]
[HttpGet()]
public HttpResponseMessage Test()


Even when logged in as Superuser you get permission denied.

Is this a bug or is the SecurityAccessLevel no longer supported?

BTW; is there anyone but us using the WebAPI in DNN?
 
New Post
9/12/2016 5:22 AM
 
On a side note, is it recommended to use DNNs WebAPI to setup an external API that will be used only for system integration rather than being called from a DNN module? The only reason why we are considering implementing this in DNN WebAPI is that we want to be able to handle user authentication in DNN with regards to security roles etc as we use that for other "Portal stuff"
 
New Post
9/16/2016 7:49 AM
 
I guess that the lack of responses here probably answers the question "BTW; is there anyone but us using the WebAPI in DNN?"
 
New Post
9/16/2016 12:18 PM
 
I have WebAPI on a live site, but I don't use the attribute that's giving you trouble.

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
www.dynamisys.co.uk
 
New Post
9/16/2016 12:35 PM
 
Richard Howells wrote:
I have WebAPI on a live site, but I don't use the attribute that's giving you trouble.



Glad to hear that. May I ask how your route mappings are set ut to handle WebAPI in DNN allowing usage of WebAPI according to best practice using simple and complex parameters?

I've found that something like this works best:


mapRouteManager.MapHttpRoute(
moduleFolderName: "MyWebAPI",
routeName: "default",
url: "{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional },
namespaces: new string[] { "MyWebAPIControllers" }
);
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesDNN WebAPI not working as expectedDNN WebAPI not working as expected


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out