Can this give me xml from dnn for me to consume with javascript on a dnn served page?

Apr 24, 2008 at 3:02 PM
Edited Apr 24, 2008 at 3:17 PM
my background: decades of coding experience and a year or so of DNN, very little javascript. I'm trying to get my head around AJAX and DNN. Forgive me if this is a dumb question, but I'd appreciate clarification, and I'm sure google will enjoy your response too! I don't want to use the ASP.NET AJAX stuff, I want to be in control of what I'm moving backward and forward myself.

I have various modules I've developed with my own tables behind the scenes. I'd like to be able to add some javascript to one of my module .ascx files that can call back into DNN to retrieve and submit data without going through a full default.aspx page request cycle. It's my understanding that I'm trying to do an 'AJAX' thing here.

I could just use a 'module' to return this data but it would be surrounded by skin rubbish. I could 'decorate' the url with dnnprintmode style stuff to strip out most of that, but I'd still have some html stuff around my xml that I don't want. Seems there should be an easy way to do this.

One thing I'm not clear on is if I make http requests from javascript within a dnn served page, will the requests automatically include the cookies that a regular browser request would include that dnn requires to establish the current session and current user context information?

So will IWebLite enable me to do all this? If so, and you could included the simplest example of a javascript snippet doing something like that I would be grateful beyond words.
Apr 25, 2008 at 11:00 AM
Edited Apr 25, 2008 at 11:03 AM
I might just end up answering my own question here (bit by bit)...

After lots of messing with this last night I think I've "honed" my understanding to include the following:

IWebLite (and SecurityContext.cs in particular) are a light-weight method of quickly hooking into the Dot Net Nuke security context in asp code that doesn't have to be within a DNN module.

I created a very simple aspx file that returned xml based on the query string parameters. The key thing with this, for me, is that the aspx file itself is independent of the DNN page / module rendering system. Rather than getting to it via Default.aspx and some tabId, I can go directly to my aspx file. But I can pass a tabId and a moduleId as query string parameters, and use the SecurityContext class within IWebLite to get my current logged in user info, and module info, and establish if the logged in user has View or Edit permission on the specified module.

This lets me implement whatever pure logic I want to query the database and dump results out in pure xml, safe(ish) in the knowledge that I can ensure I only pass the data back to appropriately permissioned users.

The only thing I haven't established yet is whether a javascript invocation of XMLHttpRequest will send enough cookie information back for SecurityContext to do it's job. I'm guessing so, but I failed in a couple of attempts to get YUI working in a module, so I'm going to play with Ext.js tonight to see if I can get any further.

Either way, having now played with SecurityContext, I would like to say thanks to Daniel for making this available. It has saved me lots of time and helped me better understand what I'm trying to do and how to achieve it in DNN.
Apr 25, 2008 at 11:10 AM
In fact I should mention that I think the code in SecurityContext opens up a whole world of other DNN 'projects' I've been wanted to get into including better handling for mobile devices, and especially support for WAP!!!
Coordinator
Apr 30, 2008 at 3:13 PM

damphlett wrote:
In fact I should mention that I think the code in SecurityContext opens up a whole world of other DNN 'projects' I've been wanted to get into including better handling for mobile devices, and especially support for WAP!!!


Hi. I'm the author of the project, but Codeplex never let me know that anybody had posted in the forums. Thanks for your comments.

I do not have a Javascript snippet right now, though I imagine you do. I do have a full HelloWorld app in Adobe Flex which does everything the HelloWorld module does (in a default DNN install in Visual Studio) through an ASMX, using SecurityContext and SWFObject4DNN (also my project). But the concepts are identical, of course. The SecurityContext lets you leverage DNN without being stuck inside it.

Anyway, thanks for your comments. I wish I had been around to answer them. If you still need a Javascript example, let me know. I haven't done AJAX stuff in a while but it's easier every time I try it.