How to use ASP.NET/PHP for a Management Server Plug-In

If you already developed a plug-in for the OTWS Management Server in ASP you may know that, as soon as you need a bit more logic in your plug-in or want to do a few more RQL request, it’s a pain to write this code as inline code into the ASP page.

Or you also have an RQL library in another language, as I have got in C#.

But you can’t use plug-ins, written in languages like PHP or ASP.NET in the CMS, because you can’t call them with parameters to forward your LoginGuid or SessionKey to the plug-in and you can’t read the session variables from another application.

Here is the solution:

You have to write a second plug-in in ASP, which reads all the session parameters and writes them into an XML structure.

You can now call this plug-in from your ASP.NET plug-in and read all the session variables you need from the XML. All you have to do to get this working, is to forward the cookies, you get from the CMS when calling your ASP.NET plug-in, to the ASP plug-in.


The code, I use in the ASP plug-in:


j = Session.Contents.Count
if j > 0 then
for each i in Session.Contents
if i = “PageGuid” or i = “LoginGuid” or i = “SessionKey” or i = “PageId” or i = “ProjectGuid” then
Response.Write(“<” & i & “><![CDATA[” & Session(i) & “]]></” & i & “>”)
end if
end if

I only need the 5 variables PageGuid, LoginGuid, SessionKey, PageId and ProjectGuid, so i only write this 5 into my page. But you can also write all of them into your XML. Only be aware, that some of them can make your XML invalid.


C# Code for forwarding the cookies:

myRequest = (HttpWebRequest)WebRequest.Create(url);
myRequest.Method = “GET”;
myRequest.CookieContainer = new CookieContainer();

//get RedDot cookies and append them to the web request
for (int i = 0; i < Request.Cookies.Count; i++)
    Cookie c = new Cookie(Request.Cookies[i].Name, Request.Cookies[i].Value, Request.Cookies[i].Path, Request.Cookies[i].Domain);
if (c.Domain == null || c.Domain == “”)
c.Domain = “xyz”;

You have to set the Domain to the correct domain of your CMS Server, otherwise it wouldn’t use the cookie and you wouldn’t get any session variables.

Leave a Reply

Your email address will not be published. Required fields are marked *