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 ExtensionsModulesModulesPortalSettings in .asmx Web ServicePortalSettings in .asmx Web Service
Previous
 
Next
New Post
11/27/2012 7:40 AM
 

Hi,

The View.ascx in my module communicates with the server through AJAx calls to a .asmx web service. In that web service, which is part of my module project, how can I access the PortalSettings object? This is needed to identify the user, mostly.

View.ascx inherits the PortalSettings object from its base class, PortalModuleBase. .aspx pages in my project inherit from DotNetNuke.Framework.PageBase and also have access to the PortalSettings object. Is there a similar base class for .asmx web services?

Thank you for any help,

Chris

 
New Post
11/27/2012 9:10 PM
 
What I have been doing is adding hidden input elements and having the module populate that with UserID, for instance, on PageLoad or with <%%> on the ascx. You could create additional hidden elements for PortalID and ModuleID depending on what you need. Depending on how you are making the request, just add these as additional parameters.

Then in the asmx.cs file reference the DNN namespaces you need and use the PortalController.GetPortal method to get a reference of the PortalInfo for the specific portal you want if thats what you want. You should be able to find the settings you want in the PortalInfo object you get from the controller. Or use the UserController to get the UserInfo for the current user.

There may be base classes or a better way, but this works for me.
 
New Post
11/28/2012 4:19 AM
 

Thank you for your reply!

In my case, I'd prefer not to pass user identification as a parameter because it would allow other users to "hijack" the web service, i.e. submit data under a different user's identity.

Currently, I am storing the user ID in the session in my View.ascx.cs to retrieve it from there in the web service. However it does not seem to be very reliable. Also, since the session is shared with the portal an other modules, that might not be the best approach.

I followed your lead with the UserController which has indeed a static method GetCurrentUserInfo(), but unfortunately it returns an empty UserInfo object.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesPortalSettings in .asmx Web ServicePortalSettings in .asmx Web Service


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