This project is read-only.

mdo:aspnet and mdo:ajax

Feb 7, 2011 at 1:56 PM


I have a problem that I believe was not present with previous XsltDb versions: after an ajax call, mdo:aspnet does not work.

If you try this simple xsl, you'll see:

  • at page load editable is true (of course if you are in edit mode)
  • if you click the link, output of aspnet call is empty



EDITABLE: {{mdo:aspnet('Module.IsEditable')}}<br/>        

<a href="{mdo:jajax()}">Ajax call</a>

After the ajax call, other methods (for example mdo:isinrole) work correctly.



Feb 7, 2011 at 8:08 PM


mdo:aspnet, mdo:assign and other ASP.NET related functions can't be used in ajax call. XsltDb ajax uses special ajax.ashx so you have no objects that belongs to DNN default.aspx such as modules, containers, skins, etc.

It seems you have no easy way to perform this check outside default page context. You have to steal code of ModuleInstanceContext.IsEditable and clear out all module control related stuff.

It seems also that XsltDb has no helpers to access permissions, I think I shall make one to simplify security checks.

Feb 7, 2011 at 10:25 PM


this of course makes sense, I wasn't considering nature of such controls and their incompatibility with ajax calls.

Having more functions for permissions checking (and eventually handling :-)) would be useful indeed. Out of page context... since mdo:isinrole works with ajax calls I guess we can find a way to wrap IsEditable and such checks, am I wrong? 


Feb 8, 2011 at 7:58 AM

mdo:isinrole uses UserInfo and therefore doesn't depends on ASP.NET controls. IsEditable is a member of ASP.NET control so it is better to rewrite it completely instead of instantiating control's class without correct context. Actually, it is only a few lines of code... but I think I need a tool that will be capable to intersect permission sets of user and protected objects. 

Feb 8, 2011 at 9:03 AM


what do you mean by "intersect permission sets of user and protected objects"?


Feb 8, 2011 at 2:42 PM


I have an mdo:iseditable function for you to evaluate:

public bool iseditable()
        DotNetNuke.Entities.Modules.ModuleInfo mi = new DotNetNuke.Entities.Modules.ModuleController().GetModule(transformer.DnnSettings.M.ModuleID);
        bool editPerm = DotNetNuke.Security.Permissions.ModulePermissionController.HasModuleAccess(DotNetNuke.Security.SecurityAccessLevel.Edit, "CONTENT", mi);
        if (editPerm)
            string setting = Convert.ToString(DotNetNuke.Services.Personalization.Personalization.GetProfile("Usability", "UserMode" + transformer.DnnSettings.P.PortalID.ToString()));
            if (setting.ToUpper() == "EDIT")
                return true;
                return false;
            return false;


It appears to work properly for me, but did not spend much time on it (not yet tested within mdo:services for example).