We are automating some of our deployment using powershell. As such we use the command line tool mage.exe for signing our deployment manifests, in effect were creating them using mage.exe as well.

We needed to add the trustUrlParamter setting to one of our manifests. Using mageui.exe you just check the box for allowing the application to see the query string, but with mage.exe this isn’t possible.

What you need to do is modify the XML of the application.deployment manifest, adding the parameter as an attribute to the deployment tag.

<deployment install="true" >  

Should become

<deployment install="true" trustURLParameters="true">  

As I said, we’ve already automated the process of creating and signing deployment manifests using powershell, now we just need to add the element attribute before signing the manifest. Powershell has some nifty features for updating XML, part 3 of  Windows PowerShell in Action: Working With Text and Files in Windows PowerShell (Part 3) demonstrates this.

So just before invoking mage.exe to sign the manifest we add this litle piece of powershell code:

$xml = [xml]( Get-Content $deploymentManifestPath )
$trustUrl = $xml.CreateAttribute("trustURLParameters")
$trustUrl.psbase.Value = "true"
$null = $xml.assembly.deployment.SetAttributeNode($trustUrl)

Voila, the manifest now has the trustURLParameters set.