• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1559
  • Last Modified:

Modify ClickOnce publish page

Hi Guys,

I'm attempting to recreate the deployment page for QuickEE - http://quickee.dabas.net.au/publish.htm

All is going well, but one thing has me stumped. How can I determine the latest available version number (currently 1.1.0.68)? Within the same directory, there are a number of folders and files. There are a number of files, with the naming format 'QuickEE_1_1_0_68.application'. Is there a way to check each of these files and return the latest version using JavaScript?

Cheers,

Wayne
0
Wayne Taylor (webtubbs)
Asked:
Wayne Taylor (webtubbs)
  • 6
  • 4
1 Solution
 
Michel PlungjanIT ExpertCommented:
JS cannot read a server directory.
What it can do is read a (manifest ) file
0
 
Michel PlungjanIT ExpertCommented:
Cant you dump a
version.js
in there which just does a

document.write('1_1_0_68')

and which is updated by your deployment package?
0
 
Wayne Taylor (webtubbs)Author Commented:
Thanks, mplungjan.

Is it possible to read http://quickee.dabas.net.au/QuickEE.application with js? It contains this....

<assemblyIdentity name="QuickEE.application" version="1.1.0.68" publicKeyToken="ab611e03a95fb421" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />

Wayne
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
Michel PlungjanIT ExpertCommented:
Absolutely

xmlhttp request to the resque...

Do you use prototype.js?

0
 
Wayne Taylor (webtubbs)Author Commented:
No. There are no js files involved at all. All is contained in publish.htm.
0
 
Michel PlungjanIT ExpertCommented:
<script>
var req;
function retrieveURL(url) {
  if (window.XMLHttpRequest) { // Non-IE browsers
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) { // IE
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req) {
    //Define "callback" function
    req.onreadystatechange = processStateChange;
    try {
      req.open("GET", url, true);
      req.send('');
    } catch (e) {
      alert(e);
    }
  } else {
    document.getElementById("version").innerHTML = "XMLHTTPRequest not supported";
  }
}
 
function processStateChange() {
  if (req.readyState==4) {
    if (req.status == 200) { // OK response
      var t = req.responseText;
      version = t.substring(t.indexOf('version="')+9,t.indexOf('" publicKeyToken'))
      document.getElementById("version").innerHTML = version;
    }
}
</script>
</head>
<body onLoad="retrieveURL('QuickEE.application')">
Version: <span id="version"></span>
0
 
Wayne Taylor (webtubbs)Author Commented:
Thanks. It doesn't seem to be working. Can you take a look at http://quickee.dabas.net.au/test.htm
0
 
Michel PlungjanIT ExpertCommented:
Missing } after function body


function processStateChange() {

  if (req.readyState==4) {

    if (req.status == 200) { // OK response

      var t = req.responseText;

      version = t.substring(t.indexOf('version="')+9,t.indexOf('" publicKeyToken'))

      document.getElementById("version").innerHTML = version;

    }

}


has to be


function processStateChange() {
  if (req.readyState==4) {
    if (req.status == 200) { // OK response
      var t = req.responseText;
      version = t.substring(t.indexOf('version="')+9,t.indexOf('" publicKeyToken'))
      document.getElementById("version").innerHTML = version;
    }
  }
}

and you MUST call the retreive in the onLoad or after you define the span since it does not exist where you call it now
0
 
Michel PlungjanIT ExpertCommented:
Here is a changed version
function processStateChange() {
  if (req.readyState==4) {
    if (req.status == 200) { // OK response
      var t = req.responseText;
      alert(req.responseHtml)
      var startPos = t.indexOf('version="',50)+9;
      var endPos = t.indexOf('" publicKeyToken');
      alert(startPos+'/'+endPos)
      var ver = t.substring(startPos,endPos)
      document.getElementById("version").innerHTML = ver;
    }
  }
}


we COULD parse the xml, but then we need to have the server send text/xml headers and/or create a dom document from the text returned
0
 
Wayne Taylor (webtubbs)Author Commented:
Awesome! That works.

Many Thanks,

Wayne
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now