Developer forum

Forum » CMS - Standard features » DW version number tag/url extension...

DW version number tag/url extension...

Per Søgaard
Reply

I would like to be able to pull the DW version number of a website and show it on a list of all our websites.

Do not know the best way but with a list of site urls and an url extension like &DwVersionNo maybe i could build a list.

It could give an overview to see which solutions should be upgraded etc.


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

You could hit the Login page and parse the version number from there.

 

Otherwise, you can use reflection and grab the FilevVersion attribute from the assembly.

Cheers,

 

Imar

 
Mikkel Ricky
Reply

I like Imar's suggestion to scrape the version number from the login page. :-)

You don't have to use reflection to get the version number from Dynamicweb; just use Dynamicweb.Base.DWAssemblyVersionInformation().

Per, you can consider adding an ashx script to all your running solution and make that script return exactly the information you need. A simple example is

<%@ WebHandler Language="C#" Class="Handler" %>

using System;
using System.Web;

public class Handler : IHttpHandler {
  public void ProcessRequest (HttpContext context) {
    context.Response.ContentType = "application/json";
    context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new {
          Version = Dynamicweb.Base.DWAssemblyVersionInformation(),
          AssemblyVersion = Dynamicweb.Base.DWAssemblyVersion
        }));
  }

  public bool IsReusable {
    get {
      return false;
    }
  }
}

If you put this in Files/System/info.ashx you can get the solution information by loading http://«domain»/Files/System/info.ashx.

I'm not a security expert, but I would be very careful with exposing too much public information about my running Dynamicweb solutions, and the example script should be protected by some security measures. 

Best regards,
Mikkel

 
Martin Christensen
Reply

Is it possible to retrieve the license type of the current solution in a similar manner? Been looking through the API, but I haven't come across anything like that yet.

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Dynamicweb.Content.Management.License exists, but it is Internal/Friend...

I've made it public so you can access it from the next 8.6.1 release.

Votes for this answer: 1
 
Martin Christensen
Reply

Ok, so Dynamicweb.Content.Management.License is the class, right? I can't find it in the API, so I don't know what field to get.

 
Nicolai Høeg Pedersen
Reply

License is the class - but you need a release that is newer that 12/6 to use it...

BR Nicolai

 

You must be logged in to post in the forum