ClickOnce

A

Atul Rane

I am using ClickOnce. I want to retrive the url sended to windows Application
i am using the code for getting the querystring information:

public NameValueCollection GetQueryStringParameters()

MessageBox.Show(System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri.ToString())
MessageBox.Show(System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ToString())
MessageBox.Show(System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri.Query.ToString());
NameValueCollection nameValueTable = new NameValueCollection();

string queryString =
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri.Query.ToString();


MessageBox.Show(queryString.ToString() );
nameValueTable = HttpUtility.ParseQueryString(queryString);

return (nameValueTable);
}

But i am not able to get the querystring.
My windows applications Main function is like that :
static void Main()
{
try
{
Application.Run(new DigiScope());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "DigiScope");
}

}

Page Load event of windows aaplication is like that :
private void DigiScope_Load(object sender, EventArgs e)
{
RotationDirection.SelectedIndex = 0;


zoomLeft = AlgorithmInputs.Width;
AlgorithmInputs.Visible = false;
SetZoom.Left = 5;

try
{
NameValueCollection nameValueTable = new NameValueCollection();
/* Here i am calling the
GetQueryStringParameters(); method which should give me the query string
information */
nameValueTable = GetQueryStringParameters();

OpenImageOnViewport();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "DigiScope");
}
}
 
M

Marc Gravell

ClickOnce has query-string passing disabled by default; have you enabled
it? It varies between VS2005 and VS2008, but in VS2008 (SP1) this is:

Project Properties -> Publish -> Options... -> Manifests -> "Allow URL
parameters to be passed to application"

I don't have VS2005 handy, but it will be something similar.

Marc
 
A

Atul Rane

Marc Gravell said:
ClickOnce has query-string passing disabled by default; have you enabled
it? It varies between VS2005 and VS2008, but in VS2008 (SP1) this is:

Project Properties -> Publish -> Options... -> Manifests -> "Allow URL
parameters to be passed to application"

I don't have VS2005 handy, but it will be something similar.

Marc
Thanks Marc for your reply
I already done this but still its not working.
 
M

Marc Gravell

Try looking at:
string[] options =
AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;

This is a string[], and if it is non-null and non-empty, the first item
(i.e. options[0]) should be your startup Uri.

I use:

new Uri(options[0]).Query.TrimStart('?').Split('&')

to get the different options...

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top